4 ms·
Facebook's Reason ML might be a more approachable introduction to OCaml concepts. Reason adds a cleaner, more JavaScript-like syntax on top of the OCaml compile
by cpeterso 8y ago
Facebook's Reason ML might be a more approachable introduction to OCaml concepts. Reason adds a cleaner, more JavaScript-like syntax on top of the OCaml compiler backend.
The Reason team's primary focus appears to be compiling Reason/OCaml to JavaScript. It's a nice language, but I'm not sure why they want to pass through a OCaml "middle end" before emitting JavaScript output. Why not just write a direct Reason->JavaScript compiler similar to TypeScript?
https://reasonml.github.io/ https://reasonml.github.io/
- donut2d 8y agoReason is just a dialect of OCaml and actually uses the BuckleScript[1] compiler, which before ReasonML, just took OCaml code and transpiling it to JavaScript. It's known for being super fast and generating fast and small JavaScript. But you can compile ReasonML to native binaries as well, not just JavaScript, using the BuckleScript compiler or others like jbuilder[2]. The advantage of having OCaml as the foundation is its excellent type system. It's very mature. I'm relatively new to OCaml, just getting into it this year, but I've found that it forces me to write correct code first. I've been really impressed by it having come from the world of PHP/JavaScript/Swift and others. Personally, I greatly prefer OCaml's syntax to Reason's. I find it much simpler, and less busy. But I know a lot of people are more comfortable with Reason's syntax. I definitely wouldn't call it "cleaner", though. [1]: https://bucklescript.github.io https://bucklescript.github.io [2]: https://jbuilder.readthedocs.io https://jbuilder.readthedocs.io
- thedufer 8y agoThere is no "OCaml middle end". Reason is parsed into the same AST as OCaml, and then passed through the rest of the OCaml compiler.
- deleted 8y ago[deleted]