@reisenberg wrote a summary of our recent efforts on the compiler, and @sid asked a question about how this impacts Jane Street’s publicly released software:
How would the newer versions of the libraries that progressively use more and more of custom language be made available to the OCaml community?
This is a good question, given that it may well take years to upstream some of our compiler changes, and some of them might not be accepted by upstream at all.
In some sense, we’re in this world already. We’ve already made changes to Base, our standard library, to use the local mode in order to better support stack allocation. And this has already made it in to our public release, as you can see if you look for the [@local]
annotations in the code below.
Our strategy here was to use the new feature in a way that doesn’t break the syntax, so it could be smoothly included in our public code. This works for modes because modes can be erased without changing the semantics of the code.
This approach isn’t always possible. Consider the include functor
syntax that was mentioned in @reisenberg’s post:
module List = struct
type 'a t =
| Nil
| Cons of 'a * 'a t
let mapi t ~f = ...
include functor Make_map
end
This can’t just be desugared away, as it happens, and so we simply block ourselves from using this feature within publicly released code.
There’s an obvious tension here, since blocking ourselves from using new features makes it more painful to open source things. Part of our intent here is to prioritize the upstreaming of things that cause these problems. include functor
is an example of a feature that’s pretty small, and we think is generally quite useful, so we intend to propose it upstream soon.
I suspect unboxed types will be more like include functor
than like modes, in that it’s going to be hard to use it in a way that’s compatible with the public release. We haven’t yet really worked through what the tradeoffs will be there.
In any case, our public release code is important to us, and we’re going to continue to release new versions. We value the fact that it’s helpful to the community, but it’s also more directly valuable to us. In particular, it makes it easier for us to reuse work done by other people, since people spend the time and effort to build libraries that interoperate well with our code (notably, with Async). And also, our public release helps people take into account our usage patterns when working on the compiler or other important community tools like Merlin or OCamlformat.
y