Switch: Case Range Syntax

Robert Clipsham robert at octarineparrot.com
Wed Aug 17 12:49:35 PDT 2011


On 17/08/2011 20:35, Jacob Carlborg wrote:
> D should have a built-in range type.

+1 or maybe +2 if I get an extra vote ;)

> One that supports syntax for both
> including and excluding the last element:
>
> auto a = 3 .. 5
> auto b = 3 ... 5

<begin bikeshedding>

> Then we wouldn't need a special range syntax for switch statements. You
> could store ranges in variables and pass them to functions. opSlice
> probably wouldn't be needed, instead opIndex could be used and you would
> declare the method to take a range instead of two integers.

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list