the point of selective importing

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Jul 10 19:38:11 PDT 2006


"Ameer Armaly" <ameer_armaly at hotmail.com> wrote in message 
news:e8urqt$2vb2$1 at digitaldaemon.com...

> I've been hearing everyone toss around ideas concerning how to selectively 
> import symbols from a module, and how to fqn import a module, and I've 
> seriously been wondering: why selectively import at all?  Assuming we get 
> static import (maybe not with that keyword, but you get the point), what's 
> the need for selectively importing if we can just say:
>
> import std.stdio; // I want writefln!
> static import cool.module; //Has a toString function for a special type.
> static import std.string; //But most of the time I'll be converting ints 
> and such to strings, so I shouldn't have to specify.
>
> It might just be me, but IMHO you're trying to mix apples with oranges; 
> either you want fully qualified imports or you want standard imports.  If 
> you desperately want to mix them, then I agree with Walter in that aliases 
> should be just fine;

I like the way you think, Mr. Armaly.  I too don't see any real value in 
selective imports.  I do, however, like FQN imports.

> anyone with half a brain will put them right near the import where they 
> can be seen; anyone who doesn't do that is just a bad coder.

I can just see the replies to this statement now: "but in a _real_ project, 
aliases end up all over the file.." Right.  Sure.  Maybe if you have _no 
sense_ of coding style or consistency. 





More information about the Digitalmars-d mailing list