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

Dom DiSc dominikus at scherkl.de
Wed Jan 12 20:26:17 UTC 2022


On Monday, 10 January 2022 at 14:44:22 UTC, Elronnd wrote:
> '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.

Yep. 'cmp' should return a float (using 4 values: -1, 0, 1 and 
NaN). This allows to return NaN if some things are not 
comparable. (even better would be if D had a native 2bit type 
with exactly those 4 values)

By far the most classes will contain non-comparable values, 
because there is only a few "completely ordered" things out 
there, and most of them like simple numbers are already 
implemented.


More information about the Digitalmars-d mailing list