Am I wrong about Effects? I see them as a step back

One reason to avoid effects, even in internal implementations, is that it limits portability of the code to the OCaml 5 runtime:

  • Currently the javascript targets don’t support them. js_of_ocaml may support them at some point (probably at some unknown performance cost to be paid by all code, not just effect-using code), but Bucklescript and al. that try to produce readable Javascript may never support them at all.
  • Domain parallelism can be emulated to run sequentially on OCaml 4 (see domain-shims), but effect operations cannot easily be emulated on OCaml 4.

(Of course some programs are designed to rely on the OCaml 5 runtime, typically they implement a concurrent scheduler. Then losing some portability is par for the course. But many other potential uses of effects are not strictly necessary and could have these unforeseen portability costs, for the authors and also for the users of the library.)

1 Like