[New module system] Interfaces with definitions #1457
Labels
design needed
We need to specify precisely what we want
feature request
Asking for new or improved functionality
language
Changes or extensions to the language
parameterized modules
Related to Cryptol's parameterized modules
Consider the following example of an "interface" that's currently rejected:
We currently reject such declarations because interfaces are not allowed to define anything, they just declare the kinds/types of things. While semantically this makes sense, it is quite inconvenient as a language construct, and indeed the current system does not seem to have a way to express this sort of thing at all, which is unfortunate.
It seems that we could allow definitions in interfaces, which would essentially make them into a kind of functor. The idea would be that when a module imports an interface, it would get the parameters (just like now) but also it'd get the extra definitions. When instantiating a functor, we just need to add the definitions to the new module, at the same time when we add the parameters.
If we adapt this plan, then we can also change the handling of functors with
parameter
style parameters:parameters
blockThere is however a question of what definitions should be allowed in an
interface
. In particular, I am not quite clear if it makes sense to define modules nested in "interfaces".The text was updated successfully, but these errors were encountered: