import concerns (was Re: Historical language survey)
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sat Jul 8 17:14:05 PDT 2006
Walter Bright wrote:
> 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.
Ah, the FQN import I (and others) have been waiting for. My comment:
http://www.digitalmars.com/d/archives/digitalmars/D/28423.html
[quote:]
PROPOSAL 1, FQN import:
Introduce a new statement, identical to import, :
fqnimport <module>;
except that it only brings the <module> entity into scope. It's child
entities will have to be accessed trough the <module> entity (by FQN then).
The keyword for this statement could be "fqnimport", or perhaps a
shorter but still descriptive name like "mimport", "importm" (for import
module)? [Right now I'm favoring "importm" but am not decided;]
[/quote]
I must contested the proposed named by Walter. "static import" seems a
pretty crappy name, there is nothing "static" about it. Do we have to
recycle existing keywords? I'm not very much into this phobia of
introducing new keywords. You didn't have a problem introducing
"scope"... :P
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list