I’m pleased to announce the release of js_of_ocaml 5.0. It should soon be able available in opam.
This is the first release supporting OCaml 5 effects handlers. Thanks to Jérôme Vouillon
and Olivier Nicole for the contribution (based on previous work from Armaël Guéneau and Patrick Ferris).
Js_of_ocaml supports for effect handlers can be enabled by passing the
--enable=effects flag. This is based on transformation of the whole program to continuation-passing style. As a consequence, tail calls are also fully optimized. This is not the default for now since the generated code is slower, larger and less readable. The performance impact is especially large for code that involves a lot of function calls without allocation, since the transformation introduces many intermediate continuation functions. We hope to improve on this by transforming the code only partially to continuation-passing style, and by trying alternative compilation strategies.
See https://ocsigen.org/js_of_ocaml/latest/manual/effects to learn how to enable the support for effect handlers when using dune.
You can try it out in this OCaml toplevel running in the browser.