Import concerns revisited

Walter Bright newshound at digitalmars.com
Tue Jul 11 03:10:00 PDT 2006


Bill Baxter wrote:
> In article <e8vife$14p6$1 at digitaldaemon.com>, Walter Bright says...
> 
>> (*) And yes, you can still access the other names in the static import 
>> via FQN's. A couple posters thought that might be a problem, but:
>> 1) I doubt many are going to accidentally type in a FQN;
>> 2) FQN's are not going to produce name collisions unless you happen to 
>> name your symbols the same as the topmost package name, which is just 
>> not realistically going to be a problem.
> 
> Does that mean if I do
> 
> static import std.string;
> alias std.string str;
> 
> Then there will trouble if I have a variable named 'std'?
> 
> That seems like that could be a source of trouble to me.  But maybe I've
> misunderstood what you're saying.

The code:

   int std;
   import std.string;

Gives:

   test.d(2): import test.std conflicts with test.std at test.d(1)

Just like you can't do:

   int std;
   long std;



More information about the Digitalmars-d mailing list