|
|
|
|
|
by zoogeny
844 days ago
|
|
> enumerations give rise to the exceptional rule that the import of a type identifier also causes the (automatic) import of all associated constant identifiers I am confused by this assertion. I mean, if I had a module `Source` defining an enum: type MyEnum = (value1, value2, value3, value4)
and another module wanted to import it: import ( MyEnum ) from "Source"
I don't see how I have automatically imported all of the associated constant identifiers. Unless he was assuming that this would force me to import `value1`, `value2`, etc. as distinct identifiers? But it seems these ought to be namespaced inside `MyEnum`, e.g. MyEnum.value1
And one could easily imagine an import syntax to selectively import Enum values if desired: import ( MyEnum: ( value1, value3 ) ) from "Source"
Of course, I'm just making up syntax, but I hope the meaning is clear. |
|