[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||LATER -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #20 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-23 13:50:30 PDT --- RESOLVED LATER? I didn't even realize that that was an option. I take it that that means that it's something that we'd like to do with a major revision like D3 but don't intend to do with the current version of the language? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #10 from Walter Bright bugzi...@digitalmars.com 2012-07-22 12:11:46 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
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: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #13 from Walter Bright bugzi...@digitalmars.com 2012-07-22 15:05:44 PDT --- (In reply to comment #12) To be fair, adding UFCS broke code using floating point literals, since 1.f became illegal. I agree that we do break things now and then as a tradeoff for something else very nice that we want. I don't agree with the rationale that if we broke something here, that means it's fair to break it there, and heck, open season on breaking things. Each breaking change must be considered on its own merits - the advantage accrued vs all the annoyance, irritation, and risk of dead D projects it engenders. Please recall all the posted complaints about D being unstable. I don't see this change as meeting that bar. After all, it's been around in C forever without making anyone's list I've seen on things I hate about C. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #14 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-22 15:15:46 PDT --- I think that the irritation caused by this should would be minimal (well disallowing 1. anyway - .1 would get _far_ more complaints), and I'd _like_ to see this change made, but if I'm going to fight over a breaking change, I'd prefer to do so over something that I care about a lot more. I don't see this change as meeting that bar. After all, it's been around in C forever without making anyone's list I've seen on things I hate about C. I expect that that's mostly because it doesn't generally affect people that don't use it, and C has _far_ worse problems. If the complaints that D is getting are generally about small stuff like this, then we're doing something very right, even if we're not doing it perfectly. If we're not going to make the change though, I think that we should close this enhancement request. It seems that we almost always leave them open even when the answer is a definitive no, which makes no sense to me. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #16 from bearophile_h...@eml.cc 2012-07-22 15:47:23 PDT --- (In reply to comment #13) After all, it's been around in C forever without making anyone's list I've seen on things I hate about C. C doesn't have UCFS. And it's on my list of the things I don't like about C. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #15 from bearophile_h...@eml.cc 2012-07-22 15:45:43 PDT --- (In reply to comment #14) If we're not going to make the change though, I think that we should close this enhancement request. There are also 8 votes on this enhancement, so there are 9 or 10 persons that like it. So maybe a small discussion in the D newsgroup is needed before closing this down. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #17 from Walter Bright bugzi...@digitalmars.com 2012-07-22 15:50:43 PDT --- I think that the irritation caused by this should would be minimal Certainly it's easy for the user to fix the code. The *problem*, though, is: I downloaded this D library and it won't compile! D sux! My working D project broke *again*. I'm sick of this. D sux! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #18 from bearophile_h...@eml.cc 2012-07-22 16:04:37 PDT --- (In reply to comment #17) Certainly it's easy for the user to fix the code. The *problem*, though, is: I downloaded this D library and it won't compile! D sux! My working D project broke *again*. I'm sick of this. D sux! Beside using -d (deprecated features) another way to face similar problems is to use an idea from Python, a switch like -future that activates features that will be introduced in future (so the -property flag gets moved into -future and removed). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added CC||and...@metalanguage.com --- Comment #19 from Andrei Alexandrescu and...@metalanguage.com 2012-07-22 21:55:49 PDT --- I'm as unexcited as Walter about this. It does make sense but the benefits are too small to account for the random breakages. Sorry. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #6 from github-bugzi...@puremagic.com 2012-07-21 03:17:30 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/735c2adbda773f8bf6a8ec6bfefe908ab366849e Changes required for issue# 6277. https://github.com/D-Programming-Language/phobos/commit/17ba4bb5940d579a7306afbfb1d4f26f424fa0aa Merge pull request #708 from jmdavis/6277 Changes required for issue# 6277. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #7 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-21 03:26:53 PDT --- https://github.com/D-Programming-Language/dmd/pull/1061 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #8 from bearophile_h...@eml.cc 2012-07-21 05:40:07 PDT --- (In reply to comment #7) https://github.com/D-Programming-Language/dmd/pull/1061 Thank you Jonathan. Pull 1061 implements half of this request: it disallow 5. and it doesn't disallow .5 Another broken symmetry :-) Is code like this nice looking? In this array one dot is missing by mistake: void main() { double[] a = [.1,.2,.3,.4,.5,6,.7,.8,.9,.10,.11,.12,.13,.14]; } And in D the leading dot syntax is already used to search in the outer scope: int x = 5; void main() { int x = 10; int y = .x; assert(y == 5); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #9 from Jonathan M Davis jmdavisp...@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 . be 0. 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: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #4 from bearophile_h...@eml.cc 2011-07-11 09:55:45 PDT --- Steven Schveighoffer reminds this is probably OK (this compiles with DMD 2.054): void main() { auto x = 1f; static assert(is(typeof(x) == float)); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6277] Disallow short floating point literals
http://d.puremagic.com/issues/show_bug.cgi?id=6277 --- Comment #3 from bearophile_h...@eml.cc 2011-07-10 13:17:38 PDT --- The proposal is for hex floating point literals too. Daniel Murphy suggests to disallow 1._3 too, to help UFCS (Numeric literals cannot *start* with an underscore already). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---