On Saturday, July 07, 2012 15:20:28 Jonathan M Davis wrote: > On Saturday, July 07, 2012 15:01:50 H. S. Teoh wrote: > > 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. > > +1 > > I think that it's ridiculous that 1. and .1 are legal. 1.f was fixed, so I > was shocked to find out recently that 1. and .1 weren't.
There's an existing enhancement request for it: http://d.puremagic.com/issues/show_bug.cgi?id=6277 - Jonathan M Davis