import concerns (was Re: Historical language survey)
Walter Bright
newshound at digitalmars.com
Sat Jul 8 01:23:09 PDT 2006
Walter Bright wrote:
>>> What can also be done is extend the import declaration to allow the
>>> .'s to continue so that specific symbols can be imported.
>>
>> Now that would be great. I believe selective-importing (as an option)
>> would be a boon in a number of ways ~ and would resolve this issue
>> quite elegantly.
>
> I like this one better, too.
There's another way - have a different kind of import declaration, say,
precede it with static:
static import foo;
which will make the symbols in foo available, but only if they are
explicitly qualified. Then one could access bar in foo by either:
foo.bar();
or:
alias foo.bar bar;
bar();
but not:
bar(); // error, undefined symbol
The advantage of this is it is a bit more flexible and more consistent
with the way the rest of D lookups work.
More information about the Digitalmars-d
mailing list