Import concerns revisited
Georg Wrede
georg.wrede at nospam.org
Wed Jul 12 00:45:09 PDT 2006
Derek Parnell wrote:
> On Wed, 12 Jul 2006 09:25:50 +0300, Georg Wrede wrote:
>>Regan Heath wrote:
>>
>>>import std.stdio as io;
>>>
>>>writefln(""); //error
>>>io.writefln(""); //ok
>>>
>>>in that this syntax allows the compiler to _not_ import into the
>>>2ndary namespace and _instead_ into the named one, instead of doing
>>>both, which is what appears does/will happen using 'alias'. I prefer this.
>>
>>Exactly!
>>
>>And this is *very important*.
>
>
> Why?
Several reasons.
- The syntax looks explicit enough for the programmer to honestly
assume that the only import is to the specified namespace.
- Doing stuff behind the back is Bad Manners.
- Importing to both would not alleviate the problem of namespace
pollution.
- Who'd understand the error messages about name clashes?
- Any outsider would really consider this a grave beginner bug from
the compiler writer.
More information about the Digitalmars-d
mailing list