Case Range Statement ..

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 7 00:56:52 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.
> 
> I was originally asking about the ambiguity of not having the extra 
> colon but anyway:

There is no ambiguity in removing the extra colon.

> 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!".

My "why" embedded two longer comments:

a) Currently "..." ends something and ".." separates something, much 
like in natural language. His suggestion would have "..." separate 
something. Why?

b) Even if we ignore (a) for the moment, the "why" is legitimate at face 
value: we have a syntax that is implemented and works. Any change to the 
syntax should mark an improvement. Where is the improvement?

Just because it doesn't not work doesn't mean it must be adopted!

It has also been suggested in an earlier thread a range with ".." should 
mean open and a range with "..." should mean closed. I explained back 
then how that proposal was a complete disaster.

> Alternatively don't use dots.

How would that work? And... why?

> I think the issue with the extra "case" and/ ";" needs to be treated 
> differently. There or not the syntax may seem inconsistent to new D users.

I swear if I didn't know anything about the feature and saw the syntax 
"case a: .. case b:" I'd know exactly what it does in a millisecond. Why 
would the syntax seem inconsistent to new D users? First of all, 
inconsistent with what? And how would you treat the issue differently?


Andrei



More information about the Digitalmars-d mailing list