reason icon indicating copy to clipboard operation
reason copied to clipboard

Multicore/effects: syntax

Open IwanKaramazow opened this issue 8 years ago • 12 comments

What's the plan to incorporate the effects syntax into Reason?

IwanKaramazow avatar May 03 '17 20:05 IwanKaramazow

Coming from redux-effects, would love to hear thinking on this. @ashaffer

joshrtay avatar Sep 29 '17 04:09 joshrtay

@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.

ashaffer avatar Sep 29 '17 15:09 ashaffer

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

OvermindDL1 avatar Sep 29 '17 15:09 OvermindDL1

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.

joshrtay avatar Sep 29 '17 16:09 joshrtay

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.

hcarty avatar Sep 29 '17 16:09 hcarty

That sounds cool. Is there a timeline for effects landing?

joshrtay avatar Sep 29 '17 16:09 joshrtay

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.

hcarty avatar Sep 29 '17 16:09 hcarty

A gentle ping: OCaml Multicore is now official. https://ocaml.org/news/ocaml-5.0

rami3l avatar Dec 16 '22 16:12 rami3l

Effects syntax didn’t land in OCaml 5.0, and Reason works with 5.0. What’s the gentle ping about ?

anmonteiro avatar Dec 17 '22 03:12 anmonteiro

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?

garyrob avatar Mar 09 '23 17:03 garyrob

  • 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 Foo vs the current type _ Effect.t += Foo IIRC) but that didn't make it to OCaml 5, so there's no syntax to add in Reason.

anmonteiro avatar Mar 09 '23 18:03 anmonteiro

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.

garyrob avatar Mar 09 '23 19:03 garyrob