Import concerns revisited

jcc7 jcc7_member at pathlink.com
Tue Jul 11 08:53:46 PDT 2006


In article <e90enb$2cbl$1 at digitaldaemon.com>, Dave says...
>
>Walter Bright wrote:
>> 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.
>>>
>>>
>>> You've seen the requested syntax for this option, Walter. Let's 
>>> revisit it again:
>>>
>>> # with m2 import func, abcd, efgh;
>> 
>> The equivalent would be:
>> 
>>     with m2 import func as f2, abcd as f3, efgh as f4;
>
>Just curious, why not:
>
>import from m2 func as f2, abcd as f3, efgh as f4;
>or
>import with m2 func as f2, abcd as f3, efgh as f4;
>
>because then it is more consistent both for D (all imports start with 
>'import') and in pure english language terms (starts with a verb instead 
>of a preposition like other C-lineage languages do with their 
>/include/import/using).

I think something like these are even better (though in the end it's going to be
an opinion thing):

import m2 = f2, abcd = f3, efgh = f4;
import m2 : f2, abcd : f3, efgh : f4;

I don't know why "as" would be used as an identifier, but D already has enough
keywords! ;)

jcc7



More information about the Digitalmars-d mailing list