import/modules

bearophile bearophileHUGS at lycos.com
Thu Jun 24 18:02:51 PDT 2010


marksibly:
> D newbie here with a few import/module related questions.

Welcome here :-)
Are your questions relative to the latest D2 version or D1?
Keep in mind that D1 and D2 module system has several bugs.


> ...doesn't work - can't find the second module.
> What am I doing wrong? Or is this just the way it works?

Even if it sounds strange, this is the way it is designed to work. For reasons that I don't fully like DMD is not like Java, it is not able to look by itself for the modules. So you need an external program to do it, there are several.


> If so, what does -I actually do?

I don't know that option in D2.


> I also notice that you seem to be able to call packages/modules
> anything you want!
> The docs state that package names=dirs and module names=files, but
> you can apparently use anything you want for either, as long as the
> module decl matches the import.

The main D designer (Walter) seems to like the module name situation like this, even if it looks wrong to me, and I have filed a bug report on it. If you subscribe to Bugzilla you can give one vote to this bug report:
http://d.puremagic.com/issues/show_bug.cgi?id=3972


> Not a biggy, but then what exactly are packages for?

I think they currently buggy. As in Python they are meant as a way to group code at a level higher than the module one.


> ps: the samples in the windows release don't work

They are probably not updated. Probably some one will work on them in less than few weeks. Keep in mind that the D2 compiler has just come out of Alpha state and the number of D devs is quite small.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list