[Issue 6277] Disallow short floating point literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 21 12:02:57 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6277



--- Comment #9 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-21 12:02:54 PDT ---
> Pull 1061 implements half of this request: it disallow "5." and it doesn't
> disallow ".5" 

Given the fact that when writing by hand, .5 wouldn't have a 0 on it and the
fact that dmd's tests use that syntax heavily, it just didn't seem reasonable
to me to force it to be 0.5. It started looking seriously ugly to me to have
have every .9999 be 0.9999 and the like. And the more code that would have to
change over a minor thing like that, the more likely Walter would be to reject
it anyway.

> Is code like this nice looking? In this array one dot is missing by mistake:

Then put the 0's in there. There's nothing stopping you from doing that.
Besides, the code isn't broken. It compiles just fine and has the same
semantics whether you add that decimal point or not. It's just a question of
aesthetics.

> And in D the leading dot syntax is already used to search in the outer scope:

There's no ambiguity there whatsoever, since an identifier can't start with 0.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list