reason
reason copied to clipboard
Multicore/effects: syntax
What's the plan to incorporate the effects syntax into Reason?
Coming from redux-effects, would love to hear thinking on this. @ashaffer
@joshrtay I think the OP is referring to this in Ocaml proper: http://kcsrk.info/ocaml/multicore/2015/05/20/effects-multicore/ The way redux-effects and other reduxy effect systems handle effects are too specific to redux, I think. Ocaml has an effects system built into the language, but it seems pretty cool. It actually seems pretty similar to how redux-effects works.
For reference: Tutorials: https://github.com/ocamllabs/ocaml-effects-tutorial OCaml with effects: https://github.com/ocamllabs/ocaml-multicore Old tutorials but very nice: https://github.com/kayceesrk/effects-examples
Ya. I was just wondering if reason is going to do anything special with syntax for effects and whether the reason community is going to make a judgement on Async, vs LWT, vs effects.
I'm new to OCAML/Reason, just trying to get a sense of the preferred approach to async.
On the OCaml side, once effects land Lwt and Async will likely move over to being based on effects or they'll go away. It's not clear yet what the end result will look like though.
That sounds cool. Is there a timeline for effects landing?
The answer has been "a few releases from now" for a while. There's a lot of work being done to nail down the semantics, limit the impact on performance for single-threaded code and maintain backwards compatibility. If you have a new project you're starting now I'd go with Lwt or Async (at least for native and JSOO compilation targets). Both are well-supported. Lwt has more broad community support, Async has the backing of Jane St.
A gentle ping: OCaml Multicore is now official. https://ocaml.org/news/ocaml-5.0
Effects syntax didn’t land in OCaml 5.0, and Reason works with 5.0. What’s the gentle ping about ?
anmonteiro wrote:
Effects syntax didn’t land in OCaml 5.0, and Reason works with 5.0. What’s the gentle ping about ?
For those of us who are newbies to OCaml and ReasonML, could you please clarify? At the time of this writing the top of the ocaml.org front page says "OCaml 5.0 is available! This release of OCaml comes with support for shared-memory parallelism through domains and direct-style concurrency through effect handlers!"
I'm not sure about the right way to reconcile that statement with what anmonteiro wrote, and am left still wondering whether (or when) ReasonML will incorporate those features. Or does it already, although I haven't been able to find reference to "multicore" in the ReasonML docs.
Is the answer that multicore is supported in OCaml libraries rather than in OCaml syntax itself, and ReasonML can use those libraries?
- Multicore and Effects are 2 separate features
- Multicore is available in the OCaml 5.0 runtime & stdlib -- reason is just a syntax layer over OCaml so we inherit those features naturally
- Effect handlers are supported as per the manual chapter
- there was early discussion about having a specific syntax for effects (
effect Foovs the currenttype _ Effect.t += FooIIRC) but that didn't make it to OCaml 5, so there's no syntax to add in Reason.
- there was early discussion about having a specific syntax for effects (
OK, thank you! I appreciate it. I do suggest that the question of Multicore might be a candidate for the FAQ section of the docs.