Focus

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jan 21 06:26:04 PST 2013


On 1/21/13, Peter Alexander <peter.alexander.au at gmail.com> wrote:
> This is being blown completely out of proportion.

I don't think so.

Consider that currently it's impossible to hide any symbols from a
user if they are located in subpackages. Which means you're forced to
either put everything into the same package and use the package access
specifier, or put everything into the same module.

The problem I have with this is it makes it impossible to separate
implementation-specific modules into their subpackages without giving
access of these symbols to the user. Consider that the following would
make a nice folder structure for a library:

lib/gui.d
lib/platform/win32/gui.d
lib/platform/posix/gui.d

Unfortunately everything in lib/platform must be public in order for
gui.d to use it, and as a consequence user-code ends up having access
to these platforms-specific implementation modules.

You could move everything into the lib folder and use the package
access specifier. That also means class methods must have package
access to prevent the user from invoking them, but this automatically
makes them non-virtual.

Bottom line is, the module system and access specifiers can use some
improvements. Language XYZ might do something in its own way, but D is
a language of its own and we should feel free to innovate.


More information about the Digitalmars-d mailing list