import concerns

Deewiant deewiant.doesnotlike.spam at gmail.com
Sat Jul 8 13:20:46 PDT 2006


kris wrote:
> the problem with the above is that the static-import would require all
> references to be "fully" prefixed. It looks ok on paper, but you'd end
> up with some very long names for references. It could be limited to use
> only the module name itself, and discard the path prefix e.g.
> 
> static import lib.text.locale.time;
> 
> auto time = new lib.text.locale.time.Time;  // where did the Time go?
> auto time = new time.Time;                  // module name only
> -----
> 
> 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".
> 

Why not use "in"?

import lib.text.locale.time in quick;

To me, the meaning is quite clear, though it may not be as plain as "as". Maybe
it helps to think of namespaces: "import 'lib.text.locale.time' into the 'quick'
namespace".



More information about the Digitalmars-d mailing list