Thread overview
import package.*
Oct 10, 2007
Yaga-Shura
Oct 10, 2007
Alexander Panek
Oct 10, 2007
Yaga-Shura
Oct 10, 2007
Bill Baxter
Oct 10, 2007
Ary Manzana
Oct 10, 2007
Ary Manzana
October 10, 2007
Hello,

I'm working for some days now with DMD 2. My question is: is there any way to include all modules that are in one package? e.g.:

module foo.bar;
module foo.bar2;
module foo.bar3;


import foo.*(that's the way its done in java)


i could create a file with:
import foo.bar;
import foo.bar2;
import foo.bar3;


and include this file. But that is not that effective, in my mind.


Greetings
Yaga-Shura
October 10, 2007
On Wed, 10 Oct 2007 12:08:55 +0200
Yaga-Shura <Yaga-Shura@yashu.de> wrote:

> I'm working for some days now with DMD 2. My question is: is there any way to include all modules that are in one package? e.g.:

I think this question has been raised /so/ often, that you should find something in both, d.D.learn and d.D, newsgroups about it.

Short answer: package/all.d publically importing all modules you want.

-- 
Alexander Panek <alexander.panek@brainsware.org>
October 10, 2007
Alexander Panek wrote:
> On Wed, 10 Oct 2007 12:08:55 +0200
> Yaga-Shura <Yaga-Shura@yashu.de> wrote:
> 
>> I'm working for some days now with DMD 2. My question is: is there
>> any way to include all modules that are in one package? e.g.:
> 
> I think this question has been raised /so/ often, that you should find
> something in both, d.D.learn and d.D, newsgroups about it.
> 
> Short answer: package/all.d publically importing all modules you want.
> 

ok, i don't searched for anything... i'm sorry for that. i will search for it and hope to find the answer WHY it's not implemented ;)
October 10, 2007
Alexander Panek wrote:
> On Wed, 10 Oct 2007 12:08:55 +0200
> Yaga-Shura <Yaga-Shura@yashu.de> wrote:
> 
>> I'm working for some days now with DMD 2. My question is: is there
>> any way to include all modules that are in one package? e.g.:
> 
> I think this question has been raised /so/ often, that you should find
> something in both, d.D.learn and d.D, newsgroups about it.

It's not exactly obvious what to search for.  "D programming import .*" doesn't quite work.

> Short answer: package/all.d publically importing all modules you want.

Or my favorite that no one else seems to like: "package/api.d", publicly importing the modules that are part of the standard API of your package.

As for the reasons why D doesn't have it -- in most of the languages where it exists (python and java to my knowledge), its use is discouraged.  Why add a feature just to recommend not using it?

--bb
October 10, 2007
Alexander Panek escribió:
> On Wed, 10 Oct 2007 12:08:55 +0200
> Yaga-Shura <Yaga-Shura@yashu.de> wrote:
> 
>> I'm working for some days now with DMD 2. My question is: is there
>> any way to include all modules that are in one package? e.g.:
> 
> I think this question has been raised /so/ often, that you should find
> something in both, d.D.learn and d.D, newsgroups about it.
> 
> Short answer: package/all.d publically importing all modules you want.
> 

I also see a downside as to how DMD is implemented: when an import is found, it's module is parsed. So if you had .*, all the modules in that package would need to be parsed...
October 10, 2007
Ary Manzana escribió:
> Alexander Panek escribió:
>> On Wed, 10 Oct 2007 12:08:55 +0200
>> Yaga-Shura <Yaga-Shura@yashu.de> wrote:
>>
>>> I'm working for some days now with DMD 2. My question is: is there
>>> any way to include all modules that are in one package? e.g.:
>>
>> I think this question has been raised /so/ often, that you should find
>> something in both, d.D.learn and d.D, newsgroups about it.
>>
>> Short answer: package/all.d publically importing all modules you want.
>>
> 
> I also see a downside as to how DMD is implemented: when an import is found, it's module is parsed. So if you had .*, all the modules in that package would need to be parsed...

Well, thinking a little more, if you had import all.d, DMD would also do that... Humm...