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 #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
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 ;