Import concerns revisited

Dave Dave_member at pathlink.com
Sun Jul 9 15:52:16 PDT 2006


Dave wrote:
> Sean Kelly wrote:
>> Dave wrote:
>>>
>>> I agree that 'from' is better than 'with', but I just don't see the 
>>> advantage of
>>>
>>> from m2 import func,abcd,efgh;
>>>
>>> over the likes of
>>>
>>> import m2.func, m2.abcd, m2.efgh as f4;
>>> import std.stdio, this.other.cool.db.lib as dblib;
>>>
>>> because then you get the aliasing in there as well. True, there's a 
>>> little redundant typing of 'm2'.
>>
>> If 'm2' is actually 'some.guys.super.cool.library.module' then the 
>> redundant typing adds up.
> 
> But then you could alias some.guys.super.cool.library.module, er,  no 
> wait... <g>
> 
> Seriously, you're spot on - I didn't consider that.
> 

Actually, how about:

import from some.long.modid func as f1, abcd, efgh as zzz;
private import from this.other.cool.db.lib as dblib;

Is more consistent w/ current syntax, maintains the visual continuity, 
allows more than one symbol import per module (w/o retyping the module), 
and combines the import w/ the alias if desired.

- Dave



More information about the Digitalmars-d mailing list