About Multicore

Does this mean that libraries like Async or Lwt will need to be ported to the new primitives involved to take advantage of the new system

It is worth splitting this question into two parts. Multicore OCaml really has two separate but related aspects: parallelism and concurrency. The parallelism is provided by the Domains module whilst the concurrency is provided by algebraic effects. So one question is whether Async and Lwt should use the parallelism features, and a separate question is whether they should the concurrency features.

I would say that the core of Lwt and Async should not use the parallelism features. All existing code for these libraries assumes that a single “thread” is running at a time and breaking that would be very painful. They could add additional features to take advantage of parallelism – for example you could imagine running one Async scheduler per Domain and providing some mechanisms for communication between “threads” on these different schedulers.

Now Lwt and Async might use the concurrency features. It is possible they could be redesigned to use algebraic effects internally. However, the main advantage of algebraic effects is that you code in direct style (with a corresponding improvement in performance), and without that it is less clear what you gain. There is also the fact that Lwt and Async are both unusual monads (certainly not the “standard” concurrency monad that you have in, say, Haskell) which might make them more difficult to reimplement in terms of algebraic effects.

Will they then be somehow obsoleted by these new features?

I’m obviously biased, but I think that the typed version of algebraic effects (see my talk here) would indeed render these libraries somewhat obsolete. Although it is worth pointing out that using typed algebraic effects for concurrency still requires you to write a scheduler – and the internals of Lwt or Async would be a great starting point for such a thing.

Last, will the new features be available in js_of_ocaml and maybe bucklescript?

KC would know more about the current status of this, but there is an implementation of algebraic effects for js_of_ocaml. It follows similar lines to the work described here, although I’m not sure whether a version using typed algebraic effects exists yet.