4 ms·
Reason is an alternative, JavaScript-like, syntax for the OCaml language. Same language, different syntax! It's crazy cool. BuckleScript is an OCaml -> ES5 comp
by yawaramin 10y ago
Reason is an alternative, JavaScript-like, syntax for the OCaml language. Same language, different syntax! It's crazy cool. BuckleScript is an OCaml -> ES5 compiler, so it actually compiles Reason to ES5 just fine.
Bloomberg and Facebook are two big users of BuckleScript. FB have a couple of folks writing significant stuff in Reason, compiling with BuckleScript, and deploying to user-facing web properties.
- deleted 10y ago[deleted]
- k__ 10y agoWhat is the difference between reason and bucklescript?
- phpnode 10y agoReason is a language, bucklescript is an alternative backend for ocaml which generates JavaScript. You write reason, you don't write bucklescript
- k__ 10y agookay, then what's the difference between ocaml and reason? :)
- phpnode 10y agoReason is a js like syntax for ocaml, semantically they're identical. Similar to coffeescript and JavaScript, except ocaml has really good support for this kind of stuff
- nerdponx 10y agoSo what you're saying is I could write a JavaScript-esque program and compile it to OCaml using Reason, and then compile it to true JavaScript using Bucklescript?
- phpnode 10y agoYes exactly, although you can avoid the middle step and go straight from reason to js because of the way bucklescript plugs into the ocaml compiler
- e12e 10y agoWhy would one prefer reason to ocaml? (Honest question)
- purity_resigns 10y agoReason's syntax is a little cleaner and it's easier to get up and running with.
- phpnode 10y agoIt is much more like JavaScript than ocaml and so you get a familiar language but one which benefits from all the cool things that ocaml can do.
- k__ 10y agoAnother n00b question: What are "all the cool things that ocaml can do"? I only saw rather simple typing examples, which didn't seem much different from what TypeScript can do. On the other hand I read often that ocaml doesn't have runtime errors, which I certainly get with TypeScript.
- yawaramin 10y agoThis is a good overview I think, although it doesn't get into specifics: https://realworldocaml.org/v1/en/html/prologue.html#why-ocaml https://realworldocaml.org/v1/en/html/prologue.html#why-ocam... Of course the rest of the book is a great read too if you're so inclined.
- eru 10y agoOCaml does have exceptions at runtime (eg if you try to take the maximum of an empty list), but generally your programmes won't have type errors at runtime.
- sgrove 10y agoI spoke quite a bit about ReasonML during 2016, hopefully this should cover a lot of what Reason is, how it relates to OCaml, and how it's different: https://www.youtube.com/watch?v=8LCmLQ1-YqQ https://www.youtube.com/watch?v=8LCmLQ1-YqQ Happy to answer any questions I didn't get to in the talk as well!