Version bug?

Walter Bright newshound2 at digitalmars.com
Sun Aug 22 22:23:33 PDT 2010


Adam Ruppe wrote:
> Should it? Note that it does work correctly if I put the version= line
> in the actual file, but that means I can't have the nice centralized
> config module anymore.

The compiler is exhibiting correct behavior.

The idea is, versions exist only in the module's scope. You cannot scope them, 
nest them, etc. they are global to the module. This means that if an imported 
module declared versions, then it could have unhygienic interactions with 
versions declared in the importers.

But manifest constant declarations, like:

    enum Foo = 7;

can be tested by the importer with static if. These declarations can be nested, 
scoped, etc., and there are protections in the language for inadvertent 
ambiguities from imports, and ways to control it - it's all very hygienic.

Versions are intended really for global, project-wide things like demo/paid 
version, etc., and should not be set by configuration files.


More information about the Digitalmars-d mailing list