ProtoObject and comparison for equality and ordering

Adam D. Ruppe destructionator at gmail.com
Tue May 14 20:00:09 UTC 2019


On Tuesday, 14 May 2019 at 19:34:12 UTC, Andrei Alexandrescu 
wrote:
> In designing ProtoObject

I think ProtoObject should define *absolutely nothing*. If an 
object wants to be comparable, let it implement opEquals and 
opCmp itself (and this is D, we can use template mixins too).

We do generically have the `is` keyword for comparing any object 
for identity. Beyond that, non-identity equality might not even 
make sense for some objects... and comparison I don't think makes 
sense for *most* classes.

So no-brainer for me, go with the static approach.


More information about the Digitalmars-d mailing list