Importing packages

Anders F Björklund afb at algonet.se
Sat Oct 28 00:54:23 PDT 2006


Mart Roosmaa wrote:

> 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.

I'm using the module.module syntax. As in: import wx.wx;

> 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.

Well, if they forget that - they have other problems :-)

> 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.

Or use the Java-like syntax, perhaps: "import std.c.*;" ?

--anders



More information about the Digitalmars-d mailing list