Official D Grammar

Bruno Medeiros brunodomedeiros+dng at gmail.com
Tue Apr 9 03:24:20 PDT 2013


On 07/04/2013 16:14, Artur Skawina wrote:
>> The "1..2" is actually mentioned in the spec:
>> >"An exception to this rule is that a .. embedded inside what looks like two floating point literals, as in 1..2, is interpreted as if the .. was separated by a space from the first integer."
>> >so it's there, even if it can be missed.
> I know, but documenting a (grammar) bug does not make it go away.
>

Who says its a bug? From my understanding, this exception is there on 
purpose, to make it easier to use the DOT_DOT operator in the slice 
expresions:

   foo[1..2] // It would be silly to have to put a space after the 1

At most you could make a case that "1." shouldn't ever parse as float, 
that the decimal part should be required if the dot is present.

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list