the point of selective importing

kris foo at bar.com
Tue Jul 11 18:12:33 PDT 2006


Derek Parnell wrote:
> Yes, there has to be a better (something that is less costly to write,
> read, and maintain) solution.
> 
>  import std.string alias str;
>  import std.regexp alias re;
>  import util.str alias utl;
>  . . .
>  re.find( ... );
>  . . .
>  str.find( ... );
>  . . .
>  utl.find( ... );
> 
> would do nicely, thank you.

I've yet to read something from anyone who feels this approach, in 
general, is not a good one. Doesn't really matter whether the symbol 
used is "alias", "as", ":", "=", or whatever.

It is clean, elegant, trivially maintained and modified, and is simple 
enough to be unburdensome for a developer. This is important, if for no 
other reason than it tends to encourage the use of safe imports. I know 
I keep harping on about that; and on, and on, and on, and on, and on.

Although, this is prefix-importing rather than selective-importing. The 
former is far and away the more important variety, IMO.



More information about the Digitalmars-d mailing list