Case Range Statement ..

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 7 06:06:08 PDT 2009


Tim Matthews wrote:
> Andrei Alexandrescu wrote:
>>
>> Existing actual or perceived inconsistencies are not an argument for 
>> adding more of them.
>>
> 
> Seriously?
> 
>>
>> a) It is not arguably better and more suggestive than the syntax in 
>> place.
> 
> I can't guarantee that it's better but I do think an argument can prove 
> a result. Thats what arguments for.
> 
>>
>> b) "(1,3)" already means two things, neither of which has anything to do 
> 
> Could you kindly state those?

(1, 2) is an expression and the argument list for a function. Neither 
suggests in the least that it's supposed to mean a sequence of case labels.

> I can see that just having "(1,3)" preceded with the "case" keyword 
> makes most other meanings impossible.

Prepare to be surprised. Compile this:

void main()
{
     switch (2)
     {
     case (1, 2): break;
     default: break;
     }
}


Andrei



More information about the Digitalmars-d mailing list