On Tue, 18 Oct 2011 13:27:18 +0200, Jacob Carlborg <[email protected]> wrote:

On 2011-10-18 09:38, Martin Nowak wrote:
http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP15

What's the advantage of this compared to importing the "_.d" file explicitly, i.e. "import pkg._;" ?


It is a paradigm shift to import a package.
Consider import std with a small sensible collection
of defaults from std.stdio, std.range and std.algorithm.
Or import gtkd and giving the library writer a defined place
for startup hooks. Also this scales much better to import
packages from non-directories, e.g. zip files or urls.

The other keypoint is that you have a simple way to obtain a packages symbol.
This symbol can be handled as any other symbol,
e.g. apply protection, pass it as template parameter or alias different packages based on a version tag. Most of this is already possible but requires you to import a submodule to obtain the package symbol.

martin

Reply via email to