Inheritance, as we have in object oriented programing languages, is not commonly used in Reason. However, we can find a couple of examples of techniques that resemble OOP-style inheritance.
Code reuse with OOP-style inheritance
Opening a module
Constantly referring to something in a module imposes a lot of writing on the developer. This is where open is handy.
Without this feature, let's say you have the ColorExample module (based on code we already used in the first example of this chapter), defined as follows:
/* A module */
module ColorExample = {
type color = [`Red | `Orange | `Yellow | `Green | `Blue ];
type rgb = [`Red | `Green | `Blue];
let onegreen: color = `Green;
let othergreen: rgb = `Green;
let stringOfColor...