FYI my experience with D' version

Adam D. Ruppe destructionator at gmail.com
Mon Jul 30 07:00:46 PDT 2012


On Sunday, 29 July 2012 at 19:20:30 UTC, Jacob Carlborg wrote:
> You could use versions which sets bool variables and use 
> static-if. I don't know if that's any better.

It'd still have the problem of the global name. Consider:

-version=use_foo

but then lib a and lib b both have:

version(use_foo)
   bool usingFoo = true;


but they have different meanings of what "foo" mean. The
bool there won't trample cross module, but the version will
still set it inappropriately.


I really think using version() for features is just always
a mistake since these things do happen anyway. The only place
where it is clear is things like platform versions.


More information about the Digitalmars-d-learn mailing list