Here’s an entire list of things that would have to be enhanced with respect to structs to cover the same functionality.
- The ability to
use
a struct and open its inherent impl into scope (it is an open question whether this should also include the methods into scope, or just the enum variants and free functions). - The ability to refer to
type
synonyms within an impl. - Optionally, the ability to parameterize datatypes based on constants in addition to types, so that two different constant parameters results in two distinct types (whether or not two applications of the same constant will result in the same type is up to the implementor; in SML, it does not, and in OCaML, it does. These are “generative” and “applicative” functors, respectively). This is the only way to pass along a configuration of constants.
- The ability to
use
an instantiation of an impl, i.e.use ::std::core::Option::<i32>
. - Lastly, just as a utility feature, it would be nice to be able to declare an
abstract struct
. These are structures only meant for the parameterization and organization of code. You can only use them to attach impls, implement traits, and use them as generic parameters. You may not include them as formal parameters, you may not create values of them, and you may not make them members of other compound datatypes. When inheritance comes around, maybe you inherent from them, but that is another open question.
I think it would take those features for me to be comfortable with not having parameterized modules. Feedback welcome on this revision.