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

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.

主站蜘蛛池模板: 徐州市| 太白县| 运城市| 库尔勒市| 昌邑市| 英德市| 定结县| 大方县| 玉林市| 汨罗市| 汉川市| 新余市| 兖州市| 信阳市| 岳西县| 周宁县| 石楼县| 太白县| 龙南县| 泸西县| 绥宁县| 固安县| 大关县| 界首市| 达州市| 翁牛特旗| 渝北区| 甘德县| 武宁县| 凌云县| 图木舒克市| 保山市| 时尚| 扶沟县| 普定县| 江孜县| 米脂县| 昆山市| 铜陵市| 孟州市| 潜江市|