Case Range Statement ..

Unknown W. Brackets unknown at simplemachines.org
Sat Jul 11 13:37:49 PDT 2009


I have not read this entire topic, but what about the following:

case 5, .., 9:

Or even:

case 5.., 9:

This actually can be very logical, IMHO, because it's saying that 9 is 
included very specifically.

Other possibilities that could be explored:

case for 5, 9:
case somekindofrange!(5, 9):

In any case, I am unsure how to indent the current syntax within my 
coding standards.  This is unacceptable to me:

case 5: .. case 9:

(which honestly has the same problem you name.)  I guess I have to use this:

case 5: ...
case 9:

But, certainly that .. will get lost.  Alas, I suppose I will pretend 
this feature of D does not exist, then.  I have serious concerns with 
loading multiple statements on one line, and otherwise it's invisible.

-[Unknown]


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 you not agree that the syntax looks a little ugly?
> 
> I haven't seen any thing less ugly that is workable.



More information about the Digitalmars-d mailing list