Use ocamlrep in editable_positioned_syntax
Summary:
We currently have four methods of converting between Rust and OCaml values (that I know of):
- the `ocaml` crate, which provides a few limited wrappers around OCaml runtime allocation functions. Since it calls into the OCaml runtime, the garbage collector may run, and we must be careful to keep values rooted while using it.
- `ToOcaml`, which was implemented for passing the CST from the Rust parser to OCaml. It passes around a SerializationContext containing a pointer to the OCaml source text, since we chose not to write those pointers into positioned tokens and trivia on the Rust side, but those fields still exist on the OCaml side. It is backed by `ocamlpool`, a library which allows us to allocate values on the OCaml heap without running the garbage collector (so that we need not root our values).
- `OcamlRep`, which was originally conceived as a means of allocating OCaml values into Rust-managed memory (coupled with generation of implementations using a procedural macro). It is now (after {
D17864960}) a generic interface for allocating OCaml values and deserializing OCaml values into Rust values.
- `Ocamlvalue`, which used a similar approach to OcamlRep (i.e., a trait and a procedural macro) to allocate values using `ocamlpool`.
Now that `ocamlrep` can allocate values using `ocamlpool` (after {
D17864957}), I think it would be nice to bring this number from four down to three. Replacing the Ocamlvalue trait with OcamlRep will also allow us to use types which implement OcamlRep in Rust binaries. This was difficult before because implementations of Ocamlvalue linked against the OCaml runtime (via `ocamlpool`).
This diff replaces Ocamlvalue with OcamlRep in EditablePositionedSyntax.
Reviewed By: shiqicao
Differential Revision:
D18076615
fbshipit-source-id:
fb9457ed44d8f89b03df8981ecb159da590550f9