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



--- Comment #12 from Jonathan M Davis <jmdavisp...@gmx.com> 2012-07-22 14:36:54 
PDT ---
> While I appreciate the rationale here, we need to stop breaking existing code.
> This is highly annoying and disruptive to existing projects, and I think it's
> implicated in a lot of abandoned D projects.

To be fair, adding UFCS broke code using floating point literals, since 1.f
became illegal. My changes would just break anyone who did 1. without a
trailing 0, which I would expect to be fairly rare. It's incredibly bizarre
IMHO that it was ever allowed (though C has done plenty of other bizarre
things). However, it's definitely true that it would have been better to make
these changes at the same time that UFCS was introduced so that all of the
floating point literal breakage occured at once.

So, ideally 1. would definitely be disallowed, and I would expect the impact of
a such a change to be minimal, since it's such an unnatural thing to do. I
expect that it's been used primarily in lieu of tagging f on the end to make an
integer literal into a floating point literal.

On the other hand, I'm not sure that I care all that much. It's stupid to allow
1., but I'm never going to use it in my code, and most other people aren't
either, so it doesn't really affect me all that much. I'd be much more
interested in fighting it if we were talking about introducing the feature
rather than it being a legacy from C which we didn't clean up and have had for
quite some time.

I did find it interesting though that it's actually _easier_ for the lexer to
allow trailing decimal points than to disallow them. My first reaction would
have been that it would have been harder (due to .. and ...), and a recent
discussion on the newsgroup about this shows that several others thought the
same. But at least with dmd's implementation (and std.conv.to's implementation
as well actually), it's easier to just let there be a trailing decimal point
rather than requiring a 0.

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

Reply via email to