Import concerns revisited

Dave Dave_member at pathlink.com
Sun Jul 9 07:54:58 PDT 2006


kris wrote:
> Walter Bright wrote:
>> Ivan Senji wrote:
>>
>>> Sure I could use
>>>
>>> static import m2;
>>> alias m2.func f2;
>>>
>>> And that would be an improvement but it is still longer (and arguably
>>> less understandable) than:
>>>
>>> import m2.func as f2; ;) :)
>>
>>
>> Let's say you're going to do more than one:
>>
>> static import m2;
>> alias m2.func f2;
>> alias m2.abcd f3;
>> alias m2.efgh f4;
>>
>> vs:
>>
>> import m2.func as f2;
>> import m2.abcd as f3;
>> import m2.efgh as f4;
>>
>> Not much of a difference. I'm also not understanding why alias is hard 
>> to understand.
> 

Yes, but you could also:

import m2.func as f2, m2.abcd as f3, m2.efgh as f4;

It's not hard for us to understand, I think most of us just like the 
syntax better and it encourages that these aliases will be kept at the 
'top' of a module for easier maintenance!

> 
> You've seen the requested syntax for this option, Walter. Let's revisit 
> it again:
> 
> # with m2 import func, abcd, efgh;
> 
> 

That doesn't address the aliasing if I'm understanding correctly (what 
if m3 is imported and has an 'abcd' and 'efgh' also)?

Also, I don't like the 'with' because it breaks the continuity of a page 
scan (for me at least). May seem silly, but I'm expecting to see lines 
starting with 'import' or 'private import' when I check out what people 
are importing.



More information about the Digitalmars-d mailing list