Bug 10369 – Deprecate unordered floating point comparisons (!<>=, etc) and later remove them

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-15T15:33:05Z
Last change time
2019-11-03T05:01:20Z
Keywords
pull
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-06-15T15:33:05Z
As part of the efforts of cleaning up detritus accumulated the D language (as Issue 10326, Issue 10321, Issue 10320, Issue 10318), maybe it's better to deprecate the floating point comparisons in D2 soon (like in dmd 2.064): http://dlang.org/expression.html#floating_point_comparisons The idea is to give a deprecation message for all the following operators, and one or two DMD versions later they should become errors (leaving them only in D1 compiler code paths): void main() { double a = 1.0; double b = 2.0; double r; r = a !<>= b; r = a <> b; r = a <>= b; r = a !<= b; r = a !< b; r = a !>= b; r = a !> b; r = a !<> b; } (Regarding built-in operators, for a scientific programmer I think a standard operator overloading for a second kind of multiplication is useful. Maybe something like ".*").
Comment #1 by yebblies — 2013-11-21T03:49:30Z
Comment #2 by yebblies — 2013-11-21T04:04:54Z
Comment #3 by bearophile_hugs — 2013-11-21T04:23:26Z
Something moves :-) Good yebblies. One of the most important warnings/deprecations is in my opinion the Issue 10318 .
Comment #4 by yebblies — 2013-11-21T04:27:22Z
(In reply to comment #3) > Something moves :-) Good yebblies. One of the most important > warnings/deprecations is in my opinion the Issue 10318 . Is the phobos sort good enough to replace it? IIRC there were some problems...
Comment #5 by braddr — 2013-11-21T22:29:29Z
Where was the discussion about the acceptability of removal? Because Bearophile wants it gone? That's hardly sufficient reason to remove features from the language. Personally, I don't care either way, but I do care about the process and this one lacks any sort of justification or agreement.
Comment #6 by issues.dlang — 2013-11-21T22:54:18Z
> Where was the discussion about the acceptability of removal? Because > Bearophile wants it gone? That's hardly sufficient reason to remove features > from the language. Personally, I don't care either way, but I do care about > the process and this one lacks any sort of justification or agreement. I believe that Walter has made comments about them being deprecated. Also, here's a thread where Andrei confirms that they're supposed to be on the chopping block: http://forum.dlang.org/post/[email protected]
Comment #7 by yebblies — 2013-11-22T00:07:24Z
(In reply to comment #5) > Where was the discussion about the acceptability of removal? Because > Bearophile wants it gone? That's hardly sufficient reason to remove features > from the language. Personally, I don't care either way, but I do care about > the process and this one lacks any sort of justification or agreement. No idea, but I remember some discussion deciding they should be deprecated, and they ended up in dlang.org/deprecate.html way back. This bug report just reminded me I'd never got around to pulling them out of druntime and disabling them.
Comment #8 by bearophile_hugs — 2013-11-22T02:46:44Z
(In reply to comment #4) > Is the phobos sort good enough to replace it? IIRC there were some problems... I have answered in Issue 10318
Comment #9 by github-bugzilla — 2013-12-12T19:07:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/97cebadfc75a332d79d00fc31e1ceed709813761 Fix Issue 10369 - Deprecate unordered floating point comparisons https://github.com/D-Programming-Language/dmd/commit/38e01f66e7e38a3be09b8b80947022f4117b0d51 Merge pull request #2844 from yebblies/issue10369 Issue 10369 - Deprecate unordered floating point comparisons
Comment #10 by github-bugzilla — 2013-12-19T04:25:12Z
Comment #11 by bearophile_hugs — 2014-01-07T18:22:31Z
Eventually the operators should be also removed from this page: http://dlang.org/lex.html
Comment #12 by acehreli — 2017-07-23T06:22:43Z
To add to bearophile's last comment, they appear on this page as well: https://wiki.dlang.org/Operator_precedence Ali
Comment #13 by iamthewilsonator — 2019-11-03T05:01:20Z
The posted example now errors: onlineapp.d(5): Error: template argument expected following ! onlineapp.d(5): Error: expression expected, not >= onlineapp.d(5): Error: found b when expecting ; following statement onlineapp.d(5): Deprecation: use { } for an empty statement, not ; onlineapp.d(6): Error: expression expected, not > onlineapp.d(6): Error: found b when expecting ; following statement onlineapp.d(6): Deprecation: use { } for an empty statement, not ; onlineapp.d(7): Error: expression expected, not >= onlineapp.d(7): Error: found b when expecting ; following statement onlineapp.d(7): Deprecation: use { } for an empty statement, not ; onlineapp.d(8): Error: template argument expected following ! onlineapp.d(9): Error: template argument expected following ! onlineapp.d(10): Error: template argument expected following ! onlineapp.d(11): Error: template argument expected following ! onlineapp.d(12): Error: template argument expected following ! onlineapp.d(12): Error: expression expected, not > onlineapp.d(12): Error: found b when expecting ; following statement onlineapp.d(12): Deprecation: use { } for an empty statement, not ;