Quantcast
Viewing all articles
Browse latest Browse all 1787

This open statement shadows the label

If you want to give the latest open higher priority, you can add ! to it.

open! Blah

But this is a last resort, it is better to do the following:

Write the module name in front of the first field of a record to explicitly tell the type system from which module it is imported.

let x = { Meh.data: 7 }
let y = { Blah.data: 9 }

And it is necessary because you may indeed ending up misguiding the type system.

Generally, I’d use open very sparingly. If you have a module with a very long name that you use quite often you can also alias it:

module MyAlias = MyVeryVeryLongModuleName

Viewing all articles
Browse latest Browse all 1787

Trending Articles