digitalmars.D - what about import something.*; ?
- Tom <Tom_member pathlink.com> Nov 22 2005
- John Demme <me teqdruid.com> Nov 22 2005
- Tom <Tom_member pathlink.com> Nov 22 2005
- John Demme <me teqdruid.com> Nov 22 2005
- Alan West <alan alanz.com> Nov 23 2005
- Derek Parnell <derek psych.ward> Nov 22 2005
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
Nov 22 2005
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
Nov 22 2005
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
Nov 22 2005
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
Nov 22 2005
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?
Nov 23 2005
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
Nov 22 2005









John Demme <me teqdruid.com> 