import concerns

Derek Parnell derek at psych.ward
Sat Jul 8 16:27:26 PDT 2006


On Sun, 09 Jul 2006 06:15:11 +1000, kris <foo at bar.com> wrote:


> but perhaps a better solution for this would arguably be
>
> import lib.text.locale.time as quick;      // use a name of your choice
>
> auto time = new quick.Time;
> -----
>
> Unfortunately this introduces a new keyword, "as".
>
> There again, both these approaches are importing all symbols from the  
> module; whereas the other proposal that most people seemed to like is an  
> extension to /selectively/ import instead:
>
> import lib.text.locale.time.Time;
>
> auto time = new Time;
> -----
>
> This is clearly more explicit. There are benefits to both approaches,  
> and while I'm in the latter camp as being the better overall solution,  
> I'd really like to see both available :)

Yes, both are needed to disabiguate members.

   import std.string.find;
   import std.regexp.find;

   find(text1, text2);  // Which 'find' do you want?

So we still need a way to do this. Maybe the 'as' keyword is not a bad  
idea here...


   import std.string.find;
   import std.regexp.find as re_find;

   re_find(text1, text2);

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list