<div class="gmail_quote">On 16 January 2012 23:19, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com">destructionator@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I somewhat rarely use version anymore. I used<br>
to use it for different client customizations<br>
to my app, but you can't turn features on and<br>
off in a a central file like that, since the<br>
version= doesn't affect other modules.<br>
<br>
I switched for a while to static if like this:<br>
<br>
version(client_a)<br>
 enum feature_x = true;<br>
version(client_b)<br>
 enum feature_x = false;<br>
<br>
<br>
== other file ==<br>
<br>
static if(feature_x)<br>
  void feature_x_impl() {}<br>
<br>
<br>
<br>
But, now, I have a way of doing it without<br>
version, and it's even better.<br>
<br>
<br>
client_a_config.d:<br>
===<br>
module app.config;<br>
enum feature_x = true;<br>
===<br>
<br>
client_b_config.d:<br>
===<br>
module app.config;<br>
enum feature_x = false;<br>
===<br>
<br>
<br>
Real file:<br>
===<br>
import app.config;<br>
<br>
static if(feature_x)<br>
 // implement<br>
===<br>
<br>
<br>
<br>
Then, I pick the desired version just by picking<br>
the file on the command line.<br>
<br>
<br>
dmd app.d client_a_config.d # build client A's version<br>
dmd app.d client_b_config.d # build client B's version<br>
<br>
<br>
<br>
So, there's no version stuff in there at all... I now<br>
think version is *almost* useless. Could probably use<br>
this for operating system versions too, putting the<br>
common components in a shared file.<br>
</blockquote></div><div><br></div><div>The fact that everyone has their own work-around, and everyone has a DIFFERENT work around is hard evidence that version() is insufficient, and the current design is making D code WORSE.</div>
<div>Even Walter describes and supports the work-arounds to use in his poses from years ago.<br><br></div><div>I can see absolutely no evidence that performing logical expressions on versions is not required by any cross platform applications, including phobos! However now, instead of expressing the logic in a concise and familiar fashion, you have to try and decode each individuals own personal work-around scheme, at the expense of 10s of lines of really ugly spaghetti, and for absolutely no benefit.</div>
<div><br></div><div>There is hard evidence people can't work without version logic, so why continue to deny it?</div><div><br></div><div>Using '} else {' as a substitute for ! for example, you're STILL typing '!', you're just writing it in the ugliest and least intuitive way possible. Are people REALLY more likely to mis-read/misunderstand the '!' in the expression than miss the obscure 'else' statement to fake the same effect?</div>
<div>Using 'version(A) version(B)' as a substitute for &&... it's still &&, except it's way longer, and it's certainly not as clear that you're really performing a boolean &&. Why not just write what it is?</div>
<div>And ||, the MOST common operation to want to perform... let's not mention the work around, it's clearly the worst. Suffice to say, you're still producing OR logic, but again, writing it in a really archaic fashion.</div>
<div><br></div><div>People ARE writing these logical constructs whether they use a clear logical expressions or not... why not just let them write it between the parentheses in a clear and concise manner, than scatter and obscure the logic across 10 lines?</div>