dmd 1.046 and 2.031 releases

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 6 22:12:12 PDT 2009


Nick Sabalausky wrote:
> "Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
> news:h2udmf$1b0c$1 at digitalmars.com...
>> Nick Sabalausky wrote:
>>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>>> news:h2u735$sn8$1 at digitalmars.com...
>>>> grauzone wrote:
>>>>> I oriented this on the syntax of array slices. Which work that way. Not 
>>>>> inconsistent at all. It's also consistent with foreach(_; x..y).
>>>> It would look consistent, but it would behave very differently. x..y for 
>>>> foreach and slices is exclusive of the y, while case x..y is inclusive.
>>>>
>>> The current way has that inconsistency:
>>>
>>> variable .. variable   // exclusive end
>>> caseLabel .. caseLabel    // inclusive end
>>>
>>> And yes, I know that's not how it's actually parsed, but that's how 
>>> people visually parse it.
>> I don't think so at all. There's a lot of punctuation that has different 
>> roles depending on the context. For example, ":" means key/value separator 
>> or ternary operator participant; "*" means multiplication or pointer 
>> dereference; "&" means taking address or binary "and"... plenty of 
>> examples. So you can't center on ".." and claim that it visually means the 
>> same thing even though the surrounding is different. You really have no 
>> argument here.
>>
> 
> Those examples are all cases where the meaning and context are wildly 
> different fbetween one use and the other. But with '..', both uses are very 
> similar: "From xxx to (incl/excl) yyy". Big differences are ok, they stand 
> out as obvious. Small differences can be more problematic.

You'd have an uphill battle using a counterfeit Swiss army knife against 
a battery of Gatling guns arguing that

case 'a': .. case 'z':

is very similar with

0 .. 10

That's actually much more different than e.g.

a = b * c;

versus

b * c;

> FWIW, Even though I dislike it, I don't think it's a sky-falling issue or 
> anything. I just don't think it's so "obviously great" as you and Walter see 
> it.

I'm not claiming it's obviously great. I do claim it's highly appropriate.

> Basically, I see it as a questionable *but* acceptable solution 
> *provided that* it's just a stop-gap in the interim before finally getting a 
> completely re-thought switch/pattern-matcher.

What is the question you are asking in the "questionable" part?


Andrei


More information about the Digitalmars-d-announce mailing list