Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 22, 2005 what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
I wonder why the following syntax isn't available in D: import somepackage.somesubpackage.*; // Import every module of the package. Wouldn't this be useful? (just like in Java) Tom |
November 22, 2005 Re: what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | Walter has stated in the past that he is opposed to this idea as merely putting something in the directory could lead to conflicts and other unexpected changes. I agree with him. When I feel I want something like this, I create an somepackage/somesubpackage/all.d which public imports everything in that directory. ~John Tom wrote: > I wonder why the following syntax isn't available in D: > > import somepackage.somesubpackage.*; // Import every module of the package. > > Wouldn't this be useful? (just like in Java) > > > Tom |
November 23, 2005 Re: what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | On Tue, 22 Nov 2005 22:25:37 +0000 (UTC), Tom wrote: > I wonder why the following syntax isn't available in D: > > import somepackage.somesubpackage.*; // Import every module of the package. > > Wouldn't this be useful? (just like in Java) Not for me. I prefer knowing what is being imported, and telling future maintainers what I was expected to be imported. -- Derek (skype: derek.j.parnell) Melbourne, Australia 23/11/2005 11:10:24 AM |
November 23, 2005 Re: what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Demme | In article <dm07m8$31c6$1@digitaldaemon.com>, John Demme says... > >Walter has stated in the past that he is opposed to this idea as merely putting something in the directory could lead to conflicts and other unexpected changes. I agree with him. When I feel I want something like this, I create an somepackage/somesubpackage/all.d which public imports everything in that directory. So Java suffers from the same problem I guess. Never thought about it. >~John > >Tom wrote: > >> I wonder why the following syntax isn't available in D: >> >> import somepackage.somesubpackage.*; // Import every module of the package. >> >> Wouldn't this be useful? (just like in Java) >> >> >> Tom > Tom |
November 23, 2005 Re: what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | Well, Java only kinda suffers from the problem. With Java, all you're importing is classes. It's much worse with D. Since an import can bring many, many symbols into the current namespace, the problem is potentially much worse- we're not talking about just classes now, but every single non-private symbol at the module level that can come in.
~John
Tom wrote:
> In article <dm07m8$31c6$1@digitaldaemon.com>, John Demme says...
>>
>>Walter has stated in the past that he is opposed to this idea as merely putting something in the directory could lead to conflicts and other unexpected changes. I agree with him. When I feel I want something like this, I create an somepackage/somesubpackage/all.d which public imports everything in that directory.
>
> So Java suffers from the same problem I guess. Never thought about it.
>
>>~John
>>
>>Tom wrote:
>>
>>> I wonder why the following syntax isn't available in D:
>>>
>>> import somepackage.somesubpackage.*; // Import every module of the package.
>>>
>>> Wouldn't this be useful? (just like in Java)
>>>
>>>
>>> Tom
>>
>
> Tom
|
November 23, 2005 Re: what about import something.*; ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Demme | John Demme wrote: > Walter has stated in the past that he is opposed to this idea as merely > putting something in the directory could lead to conflicts and other > unexpected changes. I agree with him. When I feel I want something like > this, I create an somepackage/somesubpackage/all.d which public imports > everything in that directory. I'd prefer to be able to create a module 'somepackage/somesubpackage.d' for a 'somepackage/somesubpackage/' to public import items in that directory. Currently this throws up an error though, I get the impression the D compiler checks first for isdir("somepackage/somesubpackage"), rather than isfile("somepackage/somesubpackage" ~ ".d"). Is this a minor bug or feature? |
Copyright © 1999-2021 by the D Language Foundation