import concerns (was Re: Historical language survey)

Kris Kris_member at pathlink.com
Sat Jul 8 02:14:13 PDT 2006


In article <e8nq1e$16r$1 at digitaldaemon.com>, Walter Bright says...
>
>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.

Er, that really doesn't work at all. Please ignore what I said a few minutes ago
regarding this option (I really should get some sleep instead). 

The problem here is that, for the proposed static imports, everything must be
fully-qualified with the /original import name/, and that's just plain awful for
long import names. The "import as" allows one to give it a nice short name
instead.

And, I still think the selective-import is the superior solution anyway.

(I'd delete my earlier reply, but TBird is doing really wierd things with
messages right now, and is basically hiding all my own posts)





More information about the Digitalmars-d mailing list