Final by default?

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 13 06:32:57 PDT 2014


On Wed, 12 Mar 2014 19:50:14 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 3/12/2014 4:14 PM, Ali Çehreli wrote:
>> The same issue came up with 'version' recently. It is possible to start  
>> a
>> version block like this:
>>
>>      version(something):
>>
>> However, it is not possible to get to the "else" part of that version  
>> block
>> using the above syntax. Would the same syntax work for version as well?
>>
>>      version(something):
>>          // ...
>>
>>      !version(something):
>>          // ...
>
> Yes, this has come up before, in various forms. The short answer is  
> unequivocably "no". I've expounded on this extensively in this n.g., but  
> don't have a reference handy.

Negating version is not the main problem, as one can do version(x){}  
else{}, which is ugly but effective.

Logical AND is also quite easy with version(x) version(y) {}

The one I would really like to see is logical OR. There is no easy way  
around this, one must come up with convoluted mechanisms that are much  
harder to design, write, and understand than just version(x || y)

-Steve


More information about the Digitalmars-d mailing list