On Tuesday, 10 May 2016 at 11:48:12 UTC, Joakim wrote:
This has been discussed multiple times in the forum, Walter is against it and I agree with him:

Thanks for the pointers

Another alternative is to put all such OS versioning logic in a build script somewhere and then version on features in your D code, which is probably cleanest, ie have a build script check
...
The idea is to avoid having a bunch of such repeated conditional logic for versioning spread throughout the codebase, because it will be very error-prone and brittle.

It's compiler-version-dependent, or version(unittest) or version(assert) or version(do_extra_checks). Which means my checks are inherently spread around the code. I counted 53 instances of "version.*else" in our code, which all look like

version (XXX) {} else {...}

I'm going to use my isVersion hack to avoid code duplication in "or", but for the rest of the code, I really think a version(!unittest) {...} is cleaner.

-tomer

Reply via email to