-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
This is a proposal that could actually be added to Successor ML implementations (SML/NJ and MLton).
I was looking the MLton codebase and noticed code like this popping up everywhere.
datatype z = datatype Control.Target.arch
datatype z = datatype Control.Target.os
datatype z = datatype Control.Format.t
datatype z = datatype Control.codegen
I had no idea what the point of creating an "alias" and immediately shadowing it would be. I had to look at several examples to realize the purpose of this: it's to make the constructors of each datatype available without qualification.
It would be much clearer if, instead of a weird idiom, this could be expressed directly as:
open datatype Control.Target.arch
open datatype Control.Target.os
open datatype Control.Format.t
open datatype Control.codegen
Or even:
open datatype Control.Target.arch Control.Target.os
Control.Format.t Control.codegen
Since datatype
is a keyword, it can't be the name of a module, so there's no ambiguity with open
for modules.
Hibou57
Metadata
Metadata
Assignees
Labels
No labels