You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sections on modules and module merging are very subtle, and appear ambiguous. For example, module declaration merging has this to say:
Internal modules are “open-ended” and internal module declarations with the same qualified name relative to a common root (as defined in section 2.3) contribute to a single module.
This has interesting implications. For example, consider the following code:
module M{enumE{A=1}}
module M{enumE{A=2}}
The section in the spec about enums says:
Enums are “open-ended” and enum declarations with the same qualified name relative to a common root (as defined in section 2.3) define a single enum type and contribute to a single enum object.
Section 2.3 then says:
The root module of an entity is defined as follows:
• The root module of a non-exported entity is the entity’s parent module.
These are non exported enums. So their root module is their parent module.
The parent module of an entity is defined as follows:
• The parent module of an entity declared in an internal module is that internal module.
So the parent module of the first E is the module M. So is the parent model of the second E. From the section on module merging, we know these are the same module. So both E’s have the same root module. They also have the same qualified name. Ergo, according to the sec, they should be merged. The implementation currently does not do this and we're unclear what the intention is.
The text was updated successfully, but these errors were encountered:
Courtesy of @danquirk
The sections on modules and module merging are very subtle, and appear ambiguous. For example, module declaration merging has this to say:
This has interesting implications. For example, consider the following code:
The section in the spec about enums says:
Section 2.3 then says:
These are non exported enums. So their root module is their parent module.
So the parent module of the first E is the module M. So is the parent model of the second E. From the section on module merging, we know these are the same module. So both E’s have the same root module. They also have the same qualified name. Ergo, according to the sec, they should be merged. The implementation currently does not do this and we're unclear what the intention is.
The text was updated successfully, but these errors were encountered: