Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1
Paul Backus
snarwin at gmail.com
Sat Jan 15 01:01:15 UTC 2022
On Friday, 14 January 2022 at 23:24:07 UTC, tsbockman wrote:
> 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.
Or, we templatize the AA implementation and have it call the
`toHash` and `opEquals` methods of the keys' static type. No need
for interfaces, and we can get rid of the dependency on TypeInfo
too while we're at it.
More information about the Digitalmars-d
mailing list