Indeed, having version logic has been requested many times before.
For example:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Can_I_do_an_or_in_a_version_block_33426.html
http://www.digitalmars.com/d/archives/digitalmars/D/11946.html

quote from those:
"Walter would reject it. He has stated clearly in the past that he intended version to be simple and minimal, and that adding anything onto it will only result in abuses."

I tend to think that not having version logic (&&,||,!) results in greater abuse, ie people WILL come up with their own incompatible, verbose solutions (string mixins and whatnot) to achieve the same results;

Another point is that we are sometimes too lazy to write statements as follows:
version (linux){  version = linuxOrBSD;}
version (BSD){  version = linuxOrBSD;}
version(linuxOrBSD){do_something;}
(that's ugly but it's the official recommended way; much more verbose than:
version(linux || BSD){do_something;}
)

and instead we lazily duplicate code, because "do_something" is small enough:
version (linux){  do_something;}
version (BSD){  do_something;}
Later on we (or the maintainer) update the first "do_something" and forget to update the second. Bug follows.

Seriously who hasn't encountered that?

Might as well provide a clean standard solution so everybody uses it. It should be easy to implement and wont' break any code.

Reply via email to