On Sat, Jul 07, 2012 at 11:39:59PM +0200, Mehrdad wrote: > This might sound silly, but how about if D stopped allowing 0..2 > as a range, and instead just said "invalid floating-point number"? [...]
I like writing 0..2 as a range. It's especially nice in array slice notation, where you _want_ to have it as concise as possible. OTOH, having implemented a D lexer before (just for practice, not production quality), I do see how ambiguities with floating-point numbers can cause a lot of code convolutions. But I'm gonna have to say no to this one; *I* think a better solution would be to prohibit things like 0. or 1. in a float literal. Either follow it with a digit, or don't write the dot. This will also save us a lot of pain in the UFCS department, where 4.sqrt is currently a pain to lex. Once this is done, 0..2 is no longer ambiguous, and any respectable DFA lexer should be able to handle it with ease. T -- If a person can't communicate, the very least he could do is to shut up. -- Tom Lehrer, on people who bemoan their communication woes with their loved ones.
