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

  • ReasonML Quick Start Guide
  • Raphael Rafatpanah Bruno Joseph D'mello
  • 211字
  • 2021-07-02 12:34:13

Type system

Reason's type system is sound, which means that, once compiled, there won't be runtime type errors. There is no null in the language, nor are there any bugs related to null. In JavaScript, when something is of the number type, it can also be null. Reason uses a special type for things that can also be null, and forces the developer to handle those cases appropriately by refusing to compile otherwise.

So far, we've already written some, albeit basic, Reason code without even talking about types. Reason infers types automatically. As we'll learn throughout this book, the type system is a tool that provides guarantees without getting in our way, and when used properly, can allow us to offload things to the compiler that we used to keep in our heads.

Reason's support for immutable programming, sound type system, and sophisticated module system are big parts of why Reason is so great, and there's something to be said about using all of these features together in one language that was built with these features in mind. When Facebook initially released React, they asked us to give it five minutes (https://signalvnoise.com/posts/3124-give-it-five-minutes) and, hopefully, that same frame of mind will pay off here as well.

主站蜘蛛池模板: 宁波市| 延安市| 天祝| 永清县| 鄢陵县| 昌吉市| 寻乌县| 通渭县| 内丘县| 江山市| 桑日县| 桦甸市| 临清市| 山阳县| 汾西县| 平舆县| 萍乡市| 郴州市| 民权县| 南昌市| 嘉兴市| 漳州市| 东光县| 崇信县| 名山县| 崇阳县| 左权县| 资源县| 滨海县| 古交市| 保康县| 曲阳县| 富源县| 甘南县| 雷山县| 淮阳县| 黔东| 冷水江市| 微山县| 靖远县| 景德镇市|