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

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.

主站蜘蛛池模板: 永吉县| 新源县| 河北区| 永州市| 开阳县| 玉门市| 广饶县| 双峰县| 南部县| 巫山县| 承德市| 财经| 额敏县| 龙门县| 灵宝市| 临湘市| 林甸县| 保德县| 壤塘县| 绥宁县| 武威市| 怀宁县| 舟曲县| 莱芜市| 开鲁县| 柳河县| 灵宝市| 秦安县| 吉林省| 梧州市| 唐海县| 鄂托克前旗| 宝应县| 施秉县| 同心县| 特克斯县| 利川市| 炉霍县| 广元市| 天峨县| 晋城|