To better appreciate what the above means, I'd like to give a super-condensed history lesson.
In the 1930s, mathematicians were trying to figure out what it meant to compute something. Alonzo Church invented a kind of symbol replacement language called the Lambda Calculus; Alan Turing invented a hypothetical symbol re-writing machine called the Turing Machine.
Turing Machines are cool because if a hypothetical machine can calculate anything, why not just make a real one? Hence, actual computers (and many languages written to command them) are heavily based on this concept of a stateful machine, with memory that changes over time. Examples of these imperative languages include machine code, assembly, C, and (to some extent) Ruby / Python / JS.
Astonishingly, though, it turns out Turing Machines and the Lambda Calculus are the exact same thing just expressed differently. Lambda Calculus is cool because as a language it has zero concept of information changing over time; it is a "pure" functional language in which the only entity is functions that take in inputs and return outputs.
From this concept, people have made many functional languages which avoid the pitfalls of state in various clever ways. There was LISP in 1958, which influenced ML in 1973, which in turn was realized as the dialect OCaml in 1996. (There are many other interesting functional languages such as Haskell and Elm, but since ReasonML is a dialect of OCaml we will not cover them).
So this idea of a functional language has actually been worked on and developed for many decades, and the languages involved are pretty mature. People like working in functional languages because:
In particular, the ML family of languages and languages influenced by them (e.g. Haskell) benefit from a remarkable static type system which not only protects the developer from a whole class of errors, but which can be inferred (figured out) by the compiler without forcing the developer to declare the type of every single value (à la C).
Modern web dev orbits around JS, which is what browsers can run. JS as a language has both good and not-so-good aspects, and some people would like to code in something more safe (in the sense of it prevents possible errors) and/or clever. Thus, many people write their applications in different languages, which compile / transpile to JS – for example CoffeeScript (not so much these days), TypeScript, Elm, and PureScript.
The OCaml community has already been able to compile OCaml programs to JS for a while now, with the help of Bucklescript – which is not a language (despite the name) but rather a compiler backend. So the tech needed to convert OCaml to JS is pretty mature.
However, asking web developers who get their start in JS to learn OCaml is a big sell, partly because the syntax is dramatically different. So Facebook came along and designed a way of writing OCaml which has the same semantics (meaning), but different syntax (appearance). This alternative syntax is called (drumroll) ReasonML.
In short, ReasonML is:
I am personally very bullish on ReasonML. Here's a very subjective comparison chart vis-à-vis web programming:
To me ReasonML hits a great sweet spot of benefitting from functional ideas, being easy to get up & running in, compiling well to JS, and being generally useful. The technologies it is based on (OCaml and Bucklescript) are fairly mature, although ReasonML itself is quite new and rapidly evolving. I'm interested to see how it pans out in the long term.
Hope this helps!
Great answer! I've been playing with ReasonML on weekends and it's been fun, though its still really young and rather difficult to find resources to learn from. I'm curious how your experience has been with it?
Thanks! However, I've been focusing mainly on Haskell for myself, so I cannot really go any deeper regarding ReasonML at the moment. Like I said, I'm bullish on it, but given my own (still learning, but nonzero) knowledge of pure FP, I probably would sooner focus on Elm and/or PureScript over ReasonML for my own front-end projects at this point, and Haskell for anything else. That may seem a little hypocritical, but one of the primary reasons I cited for my optimism re: ReasonML is the relatively low barrier to entry for people not already used to ML/Miranda-influenced syntax. Since I don't fall into that demographic anymore, my answer is admittedly a bit extrapolative / prescriptive. And in any case I'm not actively learning any of the above except Haskell as I said. Sorry I don't have much more insight to offer! I'm excited to see where the language goes though, and intend to eventually learn a lot more about it. :-)
EDIT: PS, I did find egghead.io/courses/get-started-wit... to be a nice beginner course, for anyone who stumbles across this. Just a starter, nothing thorough, but helpful nonetheless.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.