www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - import package.*

reply Yaga-Shura <Yaga-Shura yashu.de> writes:
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
Oct 10 2007
parent reply Alexander Panek <alexander.panek brainsware.org> writes:
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>
Oct 10 2007
next sibling parent Yaga-Shura <Yaga-Shura yashu.de> writes:
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 ;)
Oct 10 2007
prev sibling next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
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
Oct 10 2007
prev sibling parent reply Ary Manzana <ary esperanto.org.ar> writes:
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...
Oct 10 2007
parent Ary Manzana <ary esperanto.org.ar> writes:
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...
Oct 10 2007