Importing packages

Mart Roosmaa roosmaa at gmail.com
Fri Oct 27 08:15:57 PDT 2006


Hello everybody,

I am quite new to D and when learning how the packages and modules
worked, it seemed strange to me that if one wanted to import whole
packages one would have to create a module (for example a module called
"All") and do public imports of every other module in the package.

While this approach works, it's quite painful to keep that module up to
date, as people tend to forget to update the central module doing the
public imports.

Now, I propose to extend the import declaration so that if only a
package is given, it imports all modules in that package.
For example "import std.c;" would import std.c.fenv, std.c.math,
std.c.process, std.c.stdargs, etc modules.

This approach would keep the code a bit easier to maintain as one
wouldn't have to update the public imports module all the time.

What do you think? Could it be implemented in DMD?

Thanks in advance,
Mart Roosmaa




More information about the Digitalmars-d mailing list