Post

We just landed a new (experimental) feature for v12 - nested record definitions! Records is a corner stone in ReScript. However, they can't be nested without explicit definitions. Until now! Will be especially useful for deeply nested records (like options objects) not intended to be reused.

5 reposts24 likes

Yes, it's inherited from OCaml. But I'm sure there's good reason for it looking that way (one type definition per level). What we've been bothered by is the ergonomics primarily. This first implementation still uses individual records for each level, just hides it to the user in practice. 1/2

But since we're gradually moving away from the OCaml AST to our own AST it's possible for us to first-class this in the AST if we want to, and if the experiment proves fruitful. Side note - nested definitions has always been possible with structural objects, but not with records. 2/2