import concerns (was Re: Historical language survey)
Sean Kelly
sean at f4.ca
Sat Jul 8 18:49:34 PDT 2006
Walter Bright wrote:
> Kris wrote:
>> 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.
>
> Alias also works fine for making substitutes for long, awkward names:
>
> import x.y.mod;
> alias x.y.mod t;
>
> x.y.mod.foo(); // works
> t.foo(); // also works
Yup. 'as' would just be a convenience and potentially add a slight bit
of clarity. Though I'll admit to sort of liking Kris' alternate
interpretation where the alias prefix isn't optional.
>> And, I still think the selective-import is the superior solution anyway.
>
> Semantically, it isn't any different. It would even be implemented
> internally using the 'alias' machinery.
module A;
void foo() {}
void bar() {}
module B;
void bar() {}
module main;
import A.foo;
import B.bar;
foo();
bar(); // unambiguous
So not strictly the same, unless the proposal also involved always using
a namespace qualifier?
Sean
More information about the Digitalmars-d
mailing list