Feedback Thread: DIP 1042--ProtoObject--Community Review Round 1

Elronnd elronnd at elronnd.net
Mon Jan 10 14:44:22 UTC 2022


'cmp' should not return -1 when it can not compare the specified 
classes.  It should not pretend to have a significant result when 
it does not.

The DIP text implies that the given ordering is total, but it is 
not.  Consider what happens when you compare two instances of 
ProtoObject, neither of which implements Ordered and at least one 
of which is non-null.

@nogc nothrow are overly strong attributes for a comparator.  It 
may very well be desirable to allocate when performing a complex 
comparison.  And what should a comparator do when it is unable to 
compare with another object?

toHash should take a seed value.


More information about the Digitalmars-d mailing list