[proposal] version statements with multiple arguments.
1100110
0b1100110 at gmail.com
Mon Oct 22 20:17:23 PDT 2012
Looking at std.io (hopefully the right version maybe?) I see this:
version(OSX)
{ do something; }
version(Windows)
{ do the same thing as above; }
version(FreeBSD)
{ ditto; }
version(Linux)
{ finally do something different; }
and:
version(Windows) version(DigitalMars)
{ something; }
I was rather surprised that this wasn't accepted:
//Error: found '||' when expecting ')'
version(OSX || Windows || FreeBSD)
{ do something; }
version(Linux)
{ do something different; }
The last one could be intuitively described as:
version(Windows && DigitalMars)
{ blah; }
So I guess in the end I am proposing a change.
A change that I cannot see breaking backwards compatibility while also
shortening code duplication.
It also seems much more 'intuitive' to me.
version(Windows) version(DigitalMars) {}
made me think twice to make sure I knew what it was doing.
What do you guys think? If this was implemented, how could it break
backwards compatibility?
Is something like this worth a change?
Are there any drawbacks to this idea?
--
Shut up, Opera.
More information about the Digitalmars-d
mailing list