ReasonML doesn't null. Still sometimes we want to refer to something and don't know ahead if a corresponding value will be available. Reason therefor offers the Variant option shipping with the standard library.
Instructor: [00:00] Before we explore the type option, you need to understand why it's needed. For example, if you try to bind null to the integer H, it doesn't work. Null simply does not exist.
[00:12] This is great, since null is the cause for many, many bugs. In fact, its inventor, Sir Tony Hoare, stated, "I call it my billion-dollar mistake, was the invention of the null reference in 1965."
[00:28] Nevertheless, null serves a purpose. Sometimes you want to refer to something, and don't know ahead if the corresponding value will be available. Reason therefore offers the variant option, shipping with the standard library.
[00:43] An option has two constructors, for one's none, indicating that no value is available, and then some, indicating that there is a value. It is passed in as an argument of any type. We combine any of those to name. As with any other variant, we can use it in combination with the switch expression.
[01:24] This is really great. With option, we have a tool at our disposal that allows us to simulate a novel value while still being type safe, meaning a pure Reason program doesn't have null errors. What a blaze.