"Walter Bright"  wrote in message news:[email protected]...

I have yet to see a single case of "needing" boolean versions that could not be refactored into something much more readable and maintainable that did not use such.

Over time, I've gotten rid of most of that stuff from the dmd source code, and the result has been quite pleasing.

Walter, how about a compromise?

If we allow setting versions to boolean expression then it becomes much easier to use it the way you suggest, while still requiring a (hopefully) sensible name and discouraging making a mess.

eg

version(A)
{
  version(B)
  {
  }
  else
  {
     version=NeedsSomeCode;
  }
}

becomes

version NeedsSomeCode = A && !B

An example from real code would be

version valistIsCharPointer = (Linux && LP32) || Windows;

This pattern does appear frequently in your compiler code, are you for or against seeing it in D?

Reply via email to