On Tue, Sep 29, 2009 at 11:17 AM, Denis Koroskin <2kor...@gmail.com> wrote: > > I believe Java and C# took bool Object.equals(Object other); way because > they lacked generics intially and stored all the instances as Objects in > containers (having equals method in Object allowed them proper ordering > etc). > > D doesn't suffer from that problem and doesn't have to follow the same way > those languages took.
I agree, opEquals and opCmp in Object feel like out-of-date relics. It's particularly annoying how, if you want your classes to behave with arrays/AAs, you must override opEquals(Object), meaning you have to do silly downcasts at runtime. > BTW, nowadays, they define IComparable<T> interface, which is a recommended > way to implement comparison functions. I think D, with its much better generic support, could basically use duck typing and achieve the same effects without the penalty of an interface.