Re: Conditional Compilation Multiple Versions

2017-01-09 Thread Claude via Digitalmars-d-learn
Druntime uses this for its translation of POSIX header files: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/config.d An example: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/resource.d#L96 Ok, I see. Thanks! (I've gotta try reggae someday) :)

Re: Conditional Compilation Multiple Versions

2017-01-07 Thread Joakim via Digitalmars-d-learn
On Friday, 6 January 2017 at 13:44:37 UTC, Claude wrote: Yes, it works quite well for most use cases and should generally be preferred. I disagree that it scales, though. At some point (a point that is highly project-dependent), it breaks down, requiring either very large modules or duplicated

Re: Conditional Compilation Multiple Versions

2017-01-06 Thread Claude via Digitalmars-d-learn
On Friday, 6 January 2017 at 13:27:06 UTC, Mike Parker wrote: version(Windows) enum bool WindowsSupported = true; else enum bool WindowsSupported = false; Well, yes, that was a bad example. I thought to change it before sending my post but I could find any other meaningful alternative.

Re: Conditional Compilation Multiple Versions

2017-01-06 Thread Mike Parker via Digitalmars-d-learn
Glad hear it's working for you! On Friday, 6 January 2017 at 10:25:26 UTC, Claude wrote: So I had a stream of: version (Win32) enum bool WindowsSupported = true; else enum bool WindowsSupported = false; version (Win64) enum bool WindowsSupported = true; //Ooops else enum bool Windows

Re: Conditional Compilation Multiple Versions

2017-01-06 Thread Claude via Digitalmars-d-learn
On Thursday, 20 October 2016 at 09:58:07 UTC, Claude wrote: I'm digging up that thread, as I want to do some multiple conditional compilation a well. Well I'm digging up that thread again, but to post some positive experience feedback this time as I've found an answer to my own questions, and

Re: Conditional Compilation Multiple Versions

2016-10-20 Thread Claude via Digitalmars-d-learn
On Saturday, 13 June 2015 at 12:21:50 UTC, ketmar wrote: On Fri, 12 Jun 2015 20:41:59 -0400, bitwise wrote: Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) || v

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread bitwise via Digitalmars-d-learn
On Sat, 13 Jun 2015 12:20:40 -0400, ketmar wrote: On Sat, 13 Jun 2015 13:49:49 +, anonymous wrote: Taking it one step further: template Version(string name) { mixin(" version("~name~") enum Version = true; else enum Version = false; "); } static if(Version!"O

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread ketmar via Digitalmars-d-learn
On Sat, 13 Jun 2015 13:49:49 +, anonymous wrote: > Taking it one step further: > > template Version(string name) > { > mixin(" > version("~name~") enum Version = true; > else enum Version = false; > "); > } > > static if(Version!"One" || Version!"Two") > { >

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread ketmar via Digitalmars-d-learn
On Sat, 13 Jun 2015 12:01:29 -0400, bitwise wrote: >> nope. Walter is against that, so we'll not have it, despite the >> triviality of the patch. > > Any idea what the rationale was for not allowing it? i don't remember. that murmuring about "it makes the code harder to read" goes beyond me, so

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread bitwise via Digitalmars-d-learn
On Sat, 13 Jun 2015 08:21:50 -0400, ketmar wrote: On Fri, 12 Jun 2015 20:41:59 -0400, bitwise wrote: Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) || versio

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread anonymous via Digitalmars-d-learn
On Saturday, 13 June 2015 at 00:47:37 UTC, Mike Parker wrote: // config.d version(One) enum One = true; else enum One = false; version(Two) enum Two = true; else enum Two = false; // other.d import config; static if(One || Two) { ... } Taking it one step further: template Version(string

Re: Conditional Compilation Multiple Versions

2015-06-13 Thread ketmar via Digitalmars-d-learn
On Fri, 12 Jun 2015 20:41:59 -0400, bitwise wrote: > Is there a way to compile for multiple conditions? > > Tried all these: > > version(One | Two){ } > version(One || Two){ } > version(One && Two){ } > version(One) | version(Two){ } > version(One) || version(Two){ } > version(One) && version(T

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread bitwise via Digitalmars-d-learn
On Fri, 12 Jun 2015 20:55:51 -0400, Márcio Martins wrote: I know... I too hate that one can't use simple logic ops... Indeed... Thanks. Bit

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread via Digitalmars-d-learn
On Saturday, 13 June 2015 at 00:42:00 UTC, bitwise wrote: Is there a way to compile for multiple conditions? version(One) version = OneOrTwo; else version(Two) version = OneOrTwo; version(OneOrTwo) { writeln("moo"); } --- version(One) version(Two) version = OneAndTwo; version(OneAndTwo)

Re: Conditional Compilation Multiple Versions

2015-06-12 Thread Mike Parker via Digitalmars-d-learn
On 6/13/2015 9:41 AM, bitwise wrote: Is there a way to compile for multiple conditions? Tried all these: version(One | Two){ } version(One || Two){ } version(One && Two){ } version(One) | version(Two){ } version(One) || version(Two){ } version(One) && version(Two){ } Bit // config.d vers