-
-
Notifications
You must be signed in to change notification settings - Fork 420
Remove __cmp from object.d for aggregates #2633
Conversation
Thanks for your pull request and interest in making D better, @JinShil! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + druntime#2633" |
Please don't merge this PR until @andralex responds. I'm wondering if we need to add a lowering to DMD instead. But it's strange that this overload of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me if the tests are passing.
The plan here was to have the compiler lower object comparison to this. Also @edi33416 is working on defining |
Thank you @andralex Closing pending a DMD PR that will utilize this. |
I'm reopening this.
I don't know what the plan is for the code that this PR removes. @andralex, If this is not dead code, could you please elaborate on what needs to be done to utilize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can always bring this back if needed. The problem with opCmp
is that it's a member so if it's final it can't operate on null
object. cc @edi33416
Thank you @edi33416 It appears the utility of this code has yet to be determined and is pending the adjudication of work on ProtoObject. I'll close this for now until those design decisions are made. |
I don't know what's happening as I'm not intimately involved in the design of ProtoObject. I thought, based on this thread, that the value of comparing two objects was in question. I don't know what, if any, decision has been made about that, but I would be interested to know. As I mentioned in that thread, I would prefer a clear distinction between "reference comparisons", "value comparisons", and "hash comparisons". |
@edi33416 we need that lowering to compare properly null objects. Otherwise code like this will crash: class Widget { ... defines opCmp ... }
auto w1 = new Widget;
Widget w2 = null;
if (w2 < w1) {} If all we do is lower to |
Surprisingly it doesn't appear to be utilized anywhere. Let's see what the test suite says.