December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Xinok | Xinok wrote:
> So perhaps defining an alias would work best:
> virtual import mod : package.sub_package.vendor;
> import mod.module_a.sub1, mod.module_a.sub2, mod.module_b;
What about:
alias package.sub_package.vendor mod;
import mod.module_a.sub1;
import mod.module_a.sub2;
import mod.module_b;
?
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to janderson | janderson wrote:
> Xinok wrote:
>
>> So perhaps defining an alias would work best:
>> virtual import mod : package.sub_package.vendor;
>> import mod.module_a.sub1, mod.module_a.sub2, mod.module_b;
>
> What about:
>
> alias package.sub_package.vendor mod;
> import mod.module_a.sub1;
> import mod.module_a.sub2;
> import mod.module_b;
>
> ?
What about using something like the With statement?
Some possible examples:
with package.sub_package.vendor {
import module_a.sub1;
import module_a.sub2;
import module_b;
}
with package.sub_package.vendor {
with module_a {
import sub1;
import sub2;
}
import module_b;
}
-- Tom J
import module_a.sub2;
import module_b;
}
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter |
> import somebodys.long.package.name.module1 : sym1,sym2,sym3;
That's what came to my mind, too. Though, I wouldn't use the ':' operator.
// might be hard to parse (?) - at least it's clear what's meant (imho)
import somebodys.long.package.name.a, .b, .c;
// might be confused with /+ import foo, bar; +/
import somebodys.long.package.name.a, b, c;
analog to:
uint a,
b,
c;
...just that the type is exchanged with a module/package path.
Other than that, I don't think one should make the import syntax too blown up. Also, I would restrict multiple module import to one path per statement, so you don't end up doing nested regex magic in your import statements. I think of something like
import a.b.[c.[a,b,d.e], f, g]
.. huh? Now guess what happens when you don't use single characters as module names only. :P
import a.b.c.a, .b, .d, .e;
import a.b.f, .g;
I'd like to have it like that.
Kind regards,
Alex
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | Alexander Panek wrote:
>
>> import somebodys.long.package.name.module1 : sym1,sym2,sym3;
>
> That's what came to my mind, too. Though, I wouldn't use the ':' operator.
>
Sorry, misunderstood that one X_X
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom Johnson | Tom Johnson wrote:
> janderson wrote:
> > Xinok wrote:
> >
> > > So perhaps defining an alias would work best:
> > > virtual import mod : package.sub_package.vendor;
> > > import mod.module_a.sub1, mod.module_a.sub2, mod.module_b;
> >
> > What about:
> >
> > alias package.sub_package.vendor mod;
> > import mod.module_a.sub1;
> > import mod.module_a.sub2;
> > import mod.module_b;
> >
> > ?
>
> What about using something like the With statement?
>
> Some possible examples:
>
> with package.sub_package.vendor {
> import module_a.sub1;
> import module_a.sub2;
> import module_b;
> }
>
> with package.sub_package.vendor {
> with module_a {
> import sub1;
> import sub2;
> }
> import module_b;
> }
>
> -- Tom J
>
> import module_a.sub2;
> import module_b;
> }
Or what about:
import(package.sub_package) {
import(module_a) {
import sub1;
}
}
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tomas Lindquist Olsen | Bloooat. :\
Tomas Lindquist Olsen wrote:
>> What about using something like the With statement?
>>
>> Some possible examples:
>>
>> with package.sub_package.vendor {
>> import module_a.sub1;
>> import module_a.sub2;
>> import module_b;
>> }
>>
>> with package.sub_package.vendor {
>> with module_a {
>> import sub1;
>> import sub2;
>> }
>> import module_b;
>> }
>>
>> -- Tom J
>>
>> import module_a.sub2;
>> import module_b;
>> }
>
> Or what about:
>
> import(package.sub_package) {
> import(module_a) {
> import sub1;
> }
> }
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | Alexander Panek wrote:
> Bloooat. :\
:)
Actually I agree and I don't really see why we need this at all... I dont mind copy/pasting the imports...
|
December 12, 2006 Re: Proposal for an extension to the import syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | On Mon, 11 Dec 2006 23:57:34 -0800, Alexander Panek <a.panek@brainsware.org> wrote:
> Bloooat. :\
>
Ack... all these solutions are ugly. I think "wait and see" is good enough for now. :)
-JJR
|
Copyright © 1999-2021 by the D Language Foundation