On Tue, 07 Jul 2009 08:53:49 +0200, Lars T. Kyllingstad wrote: > Ary Borenszweig wrote: >> のしいか (noshiika) escribió: >>> Thank you for the great work, Walter and all the other contributors. >>> >>> But I am a bit disappointed with the CaseRangeStatement syntax. Why is >>> it >>> case 0: .. case 9: >>> instead of >>> case 0 .. 9: >>> >>> With the latter notation, ranges can be easily used together with >>> commas, for example: >>> case 0, 2 .. 4, 6 .. 9: >>> >>> And CaseRangeStatement, being inconsistent with other syntaxes using >>> the .. operator, i.e. slicing and ForeachRangeStatement, includes the >>> endpoint. >>> Shouldn't D make use of another operator to express ranges that >>> include the endpoints as Ruby or Perl6 does? >> >> I agree. >> >> I think this syntax is yet another one of those things people looking >> at D will say "ugly" and turn their heads away. > > > When the discussion first came up in the NG, I was a bit sceptical about > Andrei's suggestion for the case range statement as well. Now, I > definitely think it's the best choice, and it's only because I realised > it can be written like this: > > case 1: > .. > case 4: > // do stuff > [snip]
I think it looks much better that way and users are more likely to be comfortable with the syntax. I hope it will be displayed in the examples that way. Still, the syntax at all looks a bit alien because it's a syntax addition.
