Why are opEquals/opCmp arguments not in or const for Objects?

Stewart Gordon smjg_1998 at yahoo.com
Mon Mar 18 18:54:37 PDT 2013


On 19/03/2013 01:17, Peter Williams wrote:
<snip>
> Am I right in thinking that removal of these methods from Object will
> mean that it will no longer be necessary for the the argument to be of
> type Object

Yes, and that's indeed a potentially good reason to remove opCmp and 
opEquals from Object, and one I'd thought of myself but hadn't got round 
to bringing into the conversation.

> and that the need for casting in the implementation will go away?

The need to cast from Object to some class just to compare objects of 
that class will go away, but you might still have similar casts it if 
you have a class with a comparator and you create subclasses of it.

Stewart.


More information about the Digitalmars-d mailing list