Case Range Statement ..

Walter Bright newshound1 at digitalmars.com
Tue Jul 7 01:19:50 PDT 2009


Tim Matthews wrote:
> Walter Bright wrote:
>> Tim Matthews wrote:
>>> But it only explains the inclusive/exclusiveness and not any of the 
>>> other points.
>>
>> Let's start with agreeing on why:
>>
>>     case X..Y:
>>
>> is not appropriate.
> 
> Do we have to be so immature about this, it's an actual topic rather 
> than the random trolls that have been posted by many here.

You did pose that case, and please forgive me for being a bit testy 
about it being repeatedly asked and answered.

> I was originally asking about the ambiguity of not having the extra 
> colon but anyway:
> 
> Yes I agree double dot for case range is inconsistent with the double 
> dot for range due to one being inclusive of the endpoint. berophile 
> suggested using tripple dot in announce and he got "why?" as a reply. 
> The "why" has already been posted but the "why not" hasn't yet people 
> reply to me with "here we go again!".
>
> Alternatively don't use dots.

As for the "why not" of:

     case X .. case Y:

it's really the same reason that ; is used to terminate a statement. The 
; is not strictly necessary, but it provides a nice anchor for parsing 
when things go wrong. You get a reasonably well targeted message with 
the right line number instead of something erratic.

As for the "why not" of ...:

... and .. are not visually very distinguishable, and frankly I can't 
see a compelling "why" for it.



More information about the Digitalmars-d mailing list