What does HackerNews think of esy?

package.json workflow for native development with Reason/OCaml

Language: Reason

As someone who wrote a fair amount of Rust and OCaml code, I have to agree with the author.

While working at Routine (YC W21), I was tasked with porting our core library to iOS to minimize duplication of business logic. This was a lucky opportunity to write something resembling a compiler: it took in schemas described with our in-house data exchange library and generated C (for FFI) and Swift code (for the end users, i.e., iOS developers).

Since Routine uses OCaml for everything (which was a big motivator for joining the company—I wanted to see how that would work out), I wrote it in OCaml. The end result is a 3-5k LOC project. It's by no means a full compiler, but it was lots of fun to write. The language got in the way incredibly rarely. On average, it made my life a lot easier. We did encounter our fair share of issues, mostly due to the cross-compilation tooling[1], third-party libraries, and intricacies of FFI. Those do take their toll on sanity.

I tried my hand at writing small compilers / interpreters in Rust, and the experience was nowhere near as smooth. It was fun, and the runtime performance is definitely there, but the ergonomics aren't the same. I especially miss first-class modules whenever I code in something other than OCaml now.

  [1]: we initially used esy [2], flirted with Nix, and eventually switched to opam-cross-ios [3].
  [1]: https://github.com/esy/esy/
  [2]: https://github.com/ocaml-cross/opam-cross-ios
What's the current status of Esy? https://github.com/esy/esy

Any plans to backport its design back to Opam?

It's great to hear that Opam is making progress! I just wished that it would be more deeply integrated with Dune. A package manager that doesn't build is not very useful to be honest. Currently the only way to not have to care about switches and be able to clearly specify dependencies is to use the esy package manager[1] (which had lock files a while ago). With their work on Rust I can only hope they get inspired by Cargo.

It's also interesting to see that they're working a lot with Rust. I've seen a lot of OCaml people switching to Rust or getting more and more into Rust, I'm wondering what this means for OCaml.

[1]: https://github.com/esy/esy/