Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1
tsbockman
thomas.bockman at gmail.com
Fri Jan 14 23:24:07 UTC 2022
On Friday, 14 January 2022 at 22:48:42 UTC, Guillaume Piolat
wrote:
> I don't think it's a valid criticism actually.
> Not too many objects actually need to be all of the following:
> hashable, ordered, have a string representation, need ==.
>
> If they need all 4, and they need it _virtually_, then pay the
> bytes.
In order to make a class work with associative arrays / hash
tables, it will need to implement at least Hash and Equals.
Similarly, any class that implements Ordered can and probably
should implement Equals, too.
At the very least, Hash and Ordered should both extend Equals so
that implementers don't have to waste another pointer on
explicitly implementing Equals when it can be done implicitly
just as well.
More information about the Digitalmars-d
mailing list