What is ReasonML? #javascript #reactjs #Facebook #Reason

What is ReasonML?  #javascript #reactjs #Facebook #Reason

  • This blog post gives a brief high-level explanation of Facebook’s new programming language, ReasonML.
  • ReasonML is a new object-functional programming language created at Facebook.
  • In essence, it is a new C-like syntax for the programming language OCaml.
  • ReasonML also supports JSX (the syntax for HTML templates inside JavaScript used by Facebook’s React framework).
  • The ReasonML team also aims to improve the OCaml ecosystem: – – ReasonML feels much like what you’d get if you cleaned up JavaScript and turned it into a statically typed functional programming language.

This blog post gives a brief high-level explanation of Facebook’s new programming language, ReasonML.

This blog post gives a brief high-level explanation of Facebook’s new programming language, ReasonML.

ReasonML is a new object-functional programming language created at Facebook. In essence, it is a new C-like syntax for the programming language OCaml. The new syntax is intended to make interoperation with JavaScript and adoption by JavaScript programmers easier. Additionally, it removes idiosyncrasies of OCaml’s syntax. ReasonML also supports JSX (the syntax for HTML templates inside JavaScript used by Facebook’s React framework). Due to ReasonML being based on OCaml, many people use the two names interchangeably. The following diagram shows how ReasonML fits into the OCaml ecosystem.

At the moment, ReasonML’s best supported compilation target is JavaScript (browsers and Node.js).

This is what ReasonML code looks like (example taken from ReasonML’s online playground).

ReasonML’s foundation, OCaml, brings the following benefits:

Full rebuild of the Reason part of the codebase is ~2s (a few hundreds of files), incremental build (the norm) is <100ms on average. The BuckleScript author estimates that the build system should scale to a few hundred thousands files in the current condition. ReasonML feels much like what you’d get if you cleaned up JavaScript and turned it into a statically typed functional programming language. I’m ambivalent about JSX in ReasonML – it has pros and cons. I’m glad that ReasonML doesn’t reinvent the wheel and is strictly based on the established OCaml. OCaml’s pragmatism means that you don’t get some…

What is ReasonML?