Why would someone use Reason?

reasonreact

#1

Hi

I heard about Reason today in React Fest yesterday. It may be future.
I have gone through Why to use React but i have a question that why would someone learn new syntax / language?
Is it faster than others?


#2

I’m very new to Reason as well, and here is what attracts me in order of importance.

  1. By far most important to me is a smart leadership making sensible and practical choices and tradeoffs, and involved with the community. Some other languages I’ve worked with seem to be very much closed to outsiders and Reason is a breath of fresh air. It’s not just Reason as it is today, it’s where Reason is heading and what it will become in the future that are shaped by their thinking.

  2. A strong focus on great error messages and overall developer experience.

  3. A VS code extension is the primary tool used by core team meaning it works perfectly.

  4. A MUCH better language than JS, primarily function and immutable.

  5. Long term viability because large companies depend on it(Facebook/Bloomberg)

  6. Ability to compile reason to native & uni-kernels is interesting for the future.

I’ve heard the saying that Reason is the “Goldilocks of languages”, and I really think that’s true in that it strikes a very nice balance. It has a bright future.


#3

Never heard this term before but quite like it.


#4

I heard that in this talk, which is great. https://youtu.be/tB705w4w6H0?t=1m50s


#5

I would suggest you read

It covers the rationale behind ReasonML.

Also @chenglou ‘s talk at React Conf 207


#6

I personally like Reason for following features:

  • It’s based on OCaml, which is a more practical functional language, which allows side-effects and imperative coding… there is no religion on “pure functions” like in Haskell and OCaml’s language features & paradigms map nicely to JavaScript
  • There is no concept of null in pure OCaml code, therefore you need to be very explicit with your type specification, which IMO is a good thing… you can design whole applications by just writing types and see if the model fits your business requirements - therefore no surprising null / undefined errors
  • Pattern Matching and Variant Types allow for very expressive typing, but this is more a general feature you see in all major functional languages
  • By theory, as long as you don’t involve too many JavaScript libraries via interop, your application will most likely run safely during runtime, as soon as it compiles
  • OCaml can compile to pretty much every mainstream platform, including efficient, small and self-contained native code (unikernels for instance are “self-contained operating-systems as executables”)

Anyways, the tooling is still far from perfect. It doesn’t come close to the TypeScript & VSCode experience… but tbh, I care more about the stability of my programs, than a shiny IDE (also I use Emacs :smile:).

I don’t like if people start to hype over tech before actually trying it. It will take time and commitment to get up to speed, depending on your background you will take short or long to understand all the nitty-gritty topics of Reason, OCaml and the JS compiler platform, called BuckleScript.

I used to use Flow, since I am more into functional programming (i need a lot of intermediate functions and I don’t want to annotate all parameters for each of those, like in TS). Reason fixes all the problems I had with Flow and gives me better boundaries between functional, immutable structures and JavaScript land.

I hope this helps.