On 28.07.2012 22:55, Adam D. Ruppe wrote:
After some experience, I've come to the conclusion that using D's version() with custom things is usually a mistake. Not always - I think it is still good for platform like tweaks, version(X86) or version(Windows), or even version(Custom_Library), (note, it is often smart to put an "else static assert(0)" at the end of platform version lists, so it doesn't pass silently on new one)But using it to enable or disable particular named features or other kind of custom configuration things is a mistake. Every time I've done it for that, I've gone back and changed it. The reason is it is too easy to get it wrong: module a: version = Foo; module b: import a; version(Foo) { this doesn't actually execute }
version is good for global options that you set with -version on the command line. And can also be used internally in a module, but doesn't work across modules. But it seems you have discovered this the hard way already.
I think there was a discussion about this a few years ago, Walter did it this way on purpose. Can't remember the details, though.
