
Another feature from Java that would be very nice in the module system is package scope. Currently, if any two modules wish to share bindings, they have to be entirely public and thus importable by anyone. But a big library often (practically always) has some common definitions that need to be shared by many modules in the library, but still are internal to the library and not meant for public consumption. A package scope would provide a means to enforce this.
I wouldn't advocate having a separate mechanism to support this. If a module "owns" a node in the hierarchy, then it also owns all children of that node, so it can use nested modules for internal functionality. This doesn't actually *enforce* the separation of the namespace because anyone can directly import the internal module, but as long as clients stick to the published interfaces it works fine. Cheers, Simon
participants (1)
-
Simon Marlow