Re: [proposal] version statements with multiple arguments.

2012-10-24 Thread Nick Treleaven
On 24/10/2012 10:40, Don Clugston wrote: On 23/10/12 05:17, 1100110 wrote: 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 so

Re: [proposal] version statements with multiple arguments.

2012-10-24 Thread Don Clugston
On 23/10/12 05:17, 1100110 wrote: 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)

Re: [proposal] version statements with multiple arguments.

2012-10-24 Thread Walter Bright
On 10/22/2012 9:26 PM, timotheecour wrote: > 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 wa

Re: [proposal] version statements with multiple arguments.

2012-10-24 Thread Walter Bright
On 10/22/2012 8:17 PM, 1100110 wrote: > The last one could be intuitively described as: > version(Windows && DigitalMars) > { blah; } It was a very deliberate design choice to not allow !, || or && in version statements. Such tend to devolve over time into unmaintainable chaos.

Re: [proposal] version statements with multiple arguments.

2012-10-23 Thread Chris Nicholson-Sauls
On Tuesday, 23 October 2012 at 04:32:02 UTC, 1100110 wrote: On Mon, 22 Oct 2012 22:31:43 -0500, Jesse Phillips wrote: That is true, and I do recall that version = something; now that I think about it. It just seems to me that version statements are essentially booleans, and could be easily

Re: [proposal] version statements with multiple arguments.

2012-10-22 Thread 1100110
On Mon, 22 Oct 2012 22:31:43 -0500, Jesse Phillips wrote: On Tuesday, 23 October 2012 at 03:22:08 UTC, 1100110 wrote: 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

Re: [proposal] version statements with multiple arguments.

2012-10-22 Thread timotheecour
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 s

Re: [proposal] version statements with multiple arguments.

2012-10-22 Thread Jesse Phillips
On Tuesday, 23 October 2012 at 03:22:08 UTC, 1100110 wrote: 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) {} mad

[proposal] version statements with multiple arguments.

2012-10-22 Thread 1100110
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) {