Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
January 26, 2005 versioning between modules | ||||
---|---|---|---|---|
| ||||
When I define version to be something in one module it is not passed to the imported modules. What I mean: module asdasda; version=something; import somemodule; version(something) dosome(); //this is executed ------------------------ module somemodule; version(something) dosome2(); //this is not executed Am I doing something wrong? |
January 26, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | In article <ct91pp$2p5i$1@digitaldaemon.com>, bobef says... > >When I define version to be something in one module it is not passed to the imported modules. What I mean: > >module asdasda; > >version=something; >import somemodule; > >version(something) dosome(); //this is executed > >------------------------ > >module somemodule; > >version(something) dosome2(); //this is not executed > >Am I doing something wrong? Yes. "VersionSpecifications and DebugSpecifications apply only to the module they appear in. The only global ones are the predefined ones and any that are specified on the command line." (http://www.digitalmars.com/d/version.html) So you should either specify the version on the command line or set it at the beginning of of each module. jcc7 |
January 27, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | Yep. This is another reason why D needs preprocessor. What if I don't need the version globaly and only for one module and modules imported by it? #define rules. In article <ct941q$2sfg$1@digitaldaemon.com>, J C Calvarese says... > >In article <ct91pp$2p5i$1@digitaldaemon.com>, bobef says... >> >>When I define version to be something in one module it is not passed to the imported modules. What I mean: >> >>module asdasda; >> >>version=something; >>import somemodule; >> >>version(something) dosome(); //this is executed >> >>------------------------ >> >>module somemodule; >> >>version(something) dosome2(); //this is not executed >> >>Am I doing something wrong? > >Yes. > >"VersionSpecifications and DebugSpecifications apply only to the module they appear in. The only global ones are the predefined ones and any that are specified on the command line." (http://www.digitalmars.com/d/version.html) > >So you should either specify the version on the command line or set it at the beginning of of each module. > >jcc7 |
January 27, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | On Thu, 27 Jan 2005 15:50:31 +0000, bobef wrote: > Yep. This is another reason why D needs preprocessor. What if I don't need the version globaly and only for one module and modules imported by it? #define rules. > No. D does not need a preprocessor. With a little creativity and familiarity, one can get version to work quite effectively. You just need to look at the problem differently than you would with #define, #ifdef, and #ifndef. D is a new language: it requires looking at things from a different perspective. In truth, version and the C preprocessor don't really have a one-to-one correspondence. I've always disliked what the preprocessor does C/C++ code. It turns it into a nightmare to read. D's version statement is a welcome replacement. - John R. |
January 27, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | "bobef" <bobef_member@pathlink.com> wrote in message news:ct91pp$2p5i$1@digitaldaemon.com... > When I define version to be something in one module it is not passed to > the > imported modules. [snip] This was discussed before http://www.digitalmars.com/d/archives/digitalmars/D/11981.html One nice idea is to allow both public and private version declarations. Currently D only has private version declarations. Seems like something to bring up again post-1.0. |
January 27, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | On Thu, 27 Jan 2005 12:39:27 -0500, Ben Hinkle wrote:
> "bobef" <bobef_member@pathlink.com> wrote in message news:ct91pp$2p5i$1@digitaldaemon.com...
>> When I define version to be something in one module it is not passed to
>> the
>> imported modules.
> [snip]
>
> This was discussed before
> http://www.digitalmars.com/d/archives/digitalmars/D/11981.html
> One nice idea is to allow both public and private version declarations.
> Currently D only has private version declarations. Seems like something to
> bring up again post-1.0.
True. That could improve upon the current versioning scheme.
|
January 28, 2005 Re: versioning between modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | "bobef" <bobef_member@pathlink.com> wrote in message news:ctb2k7$2dm5$1@digitaldaemon.com... > Yep. This is another reason why D needs preprocessor. What if I don't need the > version globaly and only for one module and modules imported by it? #define > rules. You can actually use the C preprocessor (dmpp.exe) on D source code, since the D parser supports #line. The reason that versions are either strictly global or strictly local to a module is so that modules can be parsed independently of how they are imported. They will always parse the same. This is required to support the notion of them being actually imported symbol tables, rather than being a textual inclusion. C++ has run into terrible problems trying to graft import semantics onto its textual inclusion model. D avoids that problem completely. Forcing all intermodule versions to be global will also have the (I think positive) effect of pushing the configuration of the build into one place, instead of the normal C/C++ practice of arbitrarilly distributing them all over the place. |
Copyright © 1999-2021 by the D Language Foundation