opCmp / opEquals do not actually support partial orders
Dominikus Dittes Scherkl
dominikus.scherkl at continental-corporation.com
Thu Jul 19 10:20:59 UTC 2018
On Wednesday, 18 July 2018 at 17:49:19 UTC, H. S. Teoh wrote:
> On Wed, Jul 18, 2018 at 11:30:21AM -0600, Jonathan M Davis via
> On the other hand, if opCmp is allowed to return a user-defined
> type, it would solve the problem in a neat way: just define a
> quaternary type that encapsulates the values -1, 0, 1, NaN, and
> have opCmp return the equivalent of NaN for non-comparable
> arguments. Then we could support partial orders correctly.
>
> But I have a hard time seeing this actually work in practice,
> because a user-defined return type for opCmp leads to recursion:
It already works with float, no recursion. A lot of the types I
use depend on this.
But having a language supported quarterny type would be good for
its improved speed.
More information about the Digitalmars-d
mailing list