March 07, 2014 [Issue 12311] New: Use `opCmp` for equality check if defined | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=12311 Summary: Use `opCmp` for equality check if defined Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2014-03-07 13:28:20 MSK --- As `opCmp` is enough to check for equality a compiler could use it: --- struct S { int opCmp(const S) const { return 1; } } class C { override int opCmp(Object) { return 0; } } void main() { assert(S.init != S.init); assert(new C == new C); } --- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 07, 2014 [Issue 12311] Use `opCmp` for equality check if defined | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | https://d.puremagic.com/issues/show_bug.cgi?id=12311 --- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2014-03-07 13:28:50 MSK --- With such behaviour we can change associative arrays to use `equals` instead of `compare` [1] without any breaking changes. [1] https://github.com/D-Programming-Language/druntime/pull/522 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation