On Friday, 26 June 2015 at 06:06:09 UTC, Daniel Murphy wrote:
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?

So you're trying to avoid writing this?

version(linux) version(D_LP32)
    version = valistIsCharPointer;
else version(Windows)
    version = valistIsCharPointer;

While your version is more concise, I actually think the current form is more clear.

Reply via email to