dmd 1.046 and 2.031 releases

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Jul 6 23:53:49 PDT 2009


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

Even though it's the same as case 1: .. case 4:, and even though adding 
those two newlines is just a visual change, it leaves (to me, at least) 
no doubt that this is an inclusive range even though the .. operator is 
used, simply because what I would otherwise write is:

     case 1:
     case 2:
     case 3:
     case 4:
         // do stuff

Also: Thanks for a great release, Walter, Andrei, Don, Sean and everyone 
else! (Who else are involved in core development of D2, by the way?) I 
am liking this language better and better the more I use it. And now, to 
convince the rest of the scientific community that FORTRAN must go...

-Lars


More information about the Digitalmars-d-announce mailing list