官术网_书友最值得收藏!

ReasonML

We're going to explore type-driven development using ReasonML (https://reasonml.github.io/). Reason is a JavaScript-like syntax and is also a set of tools for OCaml (https://ocaml.org/). OCaml is a mature statically typed functional programming language with excellent support for object-oriented and modular programming.

We're going to write Reason code and compile it to JavaScript using the BuckleScript compiler (https://bucklescript.github.io/). BuckleScript takes input from Reason code and outputs essentially a simple subset of ES5 (that is, no ES2015-style classes, no arrow functions, and so on). This will allow us to write strongly statically typed code and see what the output JavaScript looks like with all the types stripped away.

BuckleScript, by default, outputs JavaScript files with the extension .bs.js to distinguish them from your other JS files. You can see this in the example output file, src/Ch01/Ch01_Demo.bs.js.

The Reason toolkit currently consists of:

  • A code formatting and syntax translation tool, refmt
  • An interactive code evaluation environment, rtop
  • A build manager for native-compilation projects (we won't need this one for this book), rebuild
  • A tool that provides intellisense abilities to editors, ocamlmerlin-reason

These tools work together to provide a minimal, yet powerful, development experience. Together with a good editor (we recommend Visual Studio Code), they cover most of your day-to-day development needs.

主站蜘蛛池模板: 日照市| 双城市| 资源县| 井陉县| 九寨沟县| 大悟县| 霍林郭勒市| 安阳县| 大化| 绩溪县| 南平市| 汪清县| 白河县| 玉溪市| 抚州市| 衡阳市| 民乐县| 承德县| 邹城市| 海门市| 彭阳县| 江华| 吐鲁番市| 嵊州市| 海安县| 分宜县| 建瓯市| 遂昌县| 北宁市| 本溪市| 宝坻区| 德令哈市| 游戏| 施秉县| 万山特区| 秦皇岛市| 连山| 丹棱县| 西平县| 泰兴市| 长阳|