I'm interested in building web apps, web servers, and simple WebSocket servers. OCaml appeals to me because it has more escape hatches than Haskell and is higher level than Rust, but I've always found the ReasonML vs OCaml story confusing.
I'm interested in building web apps, web servers, and simple WebSocket servers. OCaml appeals to me because it has more escape hatches than Haskell and is higher level than Rust, but I've always found the ReasonML vs OCaml story confusing.
I don't think js_of_ocaml supports any kind of JSX. That's the only real reason to use Reason over OCaml that I know of, and it's a good one. But if I'm being frank, even if OCaml/Reason is a nicer language overall, TypeScript is a statically-typed frontend development story that has way more community buy-in and way fewer rough edges in the ecosystem. Just use it.
The recent syntax switch[1] does feel like it will further fragment the community.
And TypeScript has some pretty attractive functional projects:
https://github.com/gcanti/fp-ts
From what I have seen, there seems to be little buy-in for Reason in the Ocaml community which is not particularly surprising considering it's supposed to solve a pain point no one in the community actually has (Ocaml syntax is fine - it's obviously more Algol-like than C-like but clearly the existing community doesn't care).
Reason seems to be mostly pushed by Facebook towards Javascript developers. That might work. Then again, esy is nice.
For frontend development BuckleScript is probably better than js_of_ocaml in terms of integration with JS, bundle size and number of users. For backend development I personally think native OCaml (or Reason if you prefer it) is definitely usable. But you could also try BuckleScript bindings to node stuff if you really like node.
- JSX. OCaml has infamously never had a great UI lib, even though the language parallels with many of the functional paradigms popularized by React. JSX is a great medium to bridge that gap.
- The syntax itself. A lot of the contributors to Revery have no OCaml background, but rather JS since it's often billed as an Electron alternative. Reason's familiar syntax opens the door to many people who would be turned off by OCaml's "obscure" (not my actual thoughts) syntax.
- The tooling. Since it's just an alternative syntax for OCaml, you get all the OCaml tooling for free, plus the Reason-specific tooling. I'm a huge fan of refmt, which is a tool that parses and formats Reason source files. Sure other langs have close-ish equivalents (i.e. clang-format), but refmt is much more opinionated, meaning you never have to worry about intricacies with your formatting.
- It gets rid of syntax ambiguities like the 'dangling else' problem
- It introduces conveniences like line comments and JSX
- The tooling includes Esy, which offers an npm-like package management experience including lockfiles and build artifact caching for faster builds across projects
- The community is nice, close-knit, and helpful.