Module system of D2: to be fixed still

bearophile bearophileHUGS at lycos.com
Wed Apr 22 11:17:47 PDT 2009


Leandro Lucarella:
> grauzone:
> > - the current import semantics should be redone such that "import
> >   a.b.c.d;" works like "import d = a.b.c.d;", and add a new syntax like
> >   "import a.b.c.d.*;" to get the current behavior
> 
> Shouldn't be static import a.b.c.d;? It's a little odd to get imported
> just the last part. I'm not convinced though.

davidl:
>Yes, the package does not offer us enough functionalities. However, only saying "I have discussed/talked/stated/complained something XXX times" does nothing good to the current state. Contrarily, I prefer one list the reasons of why current one is broken and corresponding sophisticated solutions.<

I can answer both, adding a small change from what I have said last time :-)

import foo;
Imports in the current namespace the "foo" module name.

import foo: *;
Imports in the current namespace all the names inside foo, but not the "foo" module name itself.

import foo: bar, baz;
Imports in the current namespace the "bar" and "baz" names, but not the "foo" module name.
bar and baz can be anything, packages too.

Bye,
bearophile



More information about the Digitalmars-d mailing list