Case Range Statement ..

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 7 12:47:06 PDT 2009


Ary Borenszweig wrote:
> Andrei Alexandrescu wrote:
>> Rainer Deyke wrote:
>>> Andrei Alexandrescu wrote:
>>>> Now there are several problems with this. All of the following compile:
>>>
>>> Possible solution: treat all sequences as dots as part of the same
>>> token, always.
>>>
>>>> 0.....wyda
>>>> 0....wyda
>>>> 0.... wyda
>>>> 0... .wyda
>>>> 0.. .wyda
>>>> 0. ....wyda
>>>
>>> All rejected by the lexer.
>>
>> No. Actually, some, yes :o).
> 
> I think he meant those /could/ be made to be rejected by the lexer.

Hack the lexer to support a useless and dangerous feature? Now we got 
something going.

> At 
> least rejecting more than three consecutive dots leaves you with:
> 
> 0... .wyda
> 0.. .wyda
> 
> which are ok. Also "0." and the like should be rejected.

Yup, more gratuitous changes to the language. We are left with "the 
little space that could change everything".

>>
>>>> 0. .. .wyda
>>>> 0. ...wyda
>>>
>>> Legal and unambiguous.
>>
>> And throroughly confusing, which was my point.
> 
> The ".name" syntax and the "number." are the things that are confusing, 
> not the inclusive/exclusive ranges.

The .name syntax and the number. syntax are confusing. Using "..." as a 
separator multiplies confusion by a billion.


Andrei



More information about the Digitalmars-d mailing list