Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1

Adam Ruppe destructionator at gmail.com
Thu Jan 13 00:41:02 UTC 2022

I hate the feedback rules.

HS Teoh wrote:
> This makes me question the wisdom of putting opCmp in the 
> common base of all classes.

Well, this dip changes that.

But a better solution is to just deprecate Object.opCmp. It 
doesn't harm too much being there (just not generating an error 
that could be an error) but serves no use and I'd be surprised if 
anyone would miss it when it's gone, especially since the 
migration is trivial:

override int opCmp(Object rhs) {
     typeof(this) rhsCasted = cast(typeof(this) rhs;


int opCmp(typeof(this) rhs) {

The deprecation message can easily show you how to do it, and 
this change is, like with opEquals, possible today and totally 
backward/forward compatible.

More information about the Digitalmars-d mailing list