the point of selective importing
Derek Parnell
derek at nomail.afraid.org
Tue Jul 11 17:18:53 PDT 2006
On Wed, 12 Jul 2006 02:51:08 +0300, Jari-Matti Mäkelä wrote:
>> Consider the simple situation in Phobos
>>
>> std.string.find
>> std.regexp.find
>> internal.gc.gcx.find
>>
>> then add the various other 'find' members in external libraries.
>
> Ok, have to admit that's true. But do you really use them all in the
> same module?
Apparently, as that's how I got the error messages. ;-)
> If there's only a small amount of conflicting names, the
> import syntax does not have to be so incredibly complex.
Totally agree. Currently I'm using this sort of syntax ...
import std.string;
alias std.string.find str_find;
alias std.string.replace str_replace;
import std.regexp;
alias std.regexp.find re_find;
alias std.regexp.replace re_replace;
import util.str;
alias util.str.find utl_find;
. . .
re_find( ... );
. . .
str_find( ... );
. . .
utl_find( ... );
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.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
12/07/2006 10:12:04 AM
More information about the Digitalmars-d
mailing list