Search⌘ K

Open Objects

Explore how open objects in ReasonML extend the capabilities of closed objects by enabling polymorphic types and allowing new public methods without predefined type declarations. Understand the syntax and advantages of open objects through practical examples, preparing you to use more flexible object-oriented structures in ReasonML.

The Restrictions of Closed Objects

The objects we’ve dealt with until now have been closed objects. In closed objects, we cannot define public functions unless they have been declared in the type definition. Any new members in the object’s implementation would have to be values or private ...