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

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.

主站蜘蛛池模板: 扎鲁特旗| 卢氏县| 宁陵县| 紫金县| 弥勒县| 嘉峪关市| 浦城县| 什邡市| 桃园市| 涿州市| 榕江县| 彰化县| 吉隆县| 锡林浩特市| 杭州市| 常德市| 双峰县| 岗巴县| 陆河县| 宁阳县| 宁安市| 本溪| 杂多县| 永吉县| 峨山| 滦南县| 贵阳市| 连云港市| 天水市| 河源市| 六枝特区| 大连市| 江都市| 肥东县| 达州市| 荆门市| 华安县| 承德市| 五寨县| 沾益县| 平顶山市|