[proposal] version statements with multiple arguments.

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Oct 23 16:16:51 PDT 2012


On Tuesday, 23 October 2012 at 04:32:02 UTC, 1100110 wrote:
> On Mon, 22 Oct 2012 22:31:43 -0500, Jesse Phillips 
> <jessekphillips+D at gmail.com> 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 rewritten as:
> static if(true || false || false) { } by the compiler, similar 
> to how (I *think*) certain binary operators are rewritten.
> (I'm just going by what I hear, I'm not really a compiler kinda 
> guy...)
>
> It would make sense to me to be able to use boolean operators 
> on what is essentially
> a true/false statement.
>
> I'd be willing to see if I can hack together support for it, as 
> a proof of concept,
> but I wanted to see if it would be blatantly shot down first.
>
> So... What I'd really like to know is: Would *you* welcome such 
> a change?


This proposal has made a quarterly appearance since the earliest 
days of D1... and heavens yes, would I welcome it.  While the 
standard (version = Somethingable) approach is actually fine in 
many cases (self documenting, puts all the logic in one place, 
etc etc) it is also quite overkill in many cases (the logic 
matters exactly once, the logic branches differently in different 
places, etc etc).  It's the same as every toolbox having 
different types of screwdrivers.  Yes they do the same thing, but 
in different circumstances one will be clearly preferable over 
another.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list