What does &infix:<cmp> do with arguments of two different types? #28

moritz opened this Issue Dec 30, 2012 · 0 comments


None yet
1 participant

moritz commented Dec 30, 2012

S03/Comparison semantics/ is very vague about what infix:<cmp> does if its two arguments are of different types. It says:

The C<cmp> is just like the C<eqv> above except that
instead of returning C<Bool::False> or C<Bool::True> values it always
returns C<Order::Increase>, C<Order::Same>, or C<Order::Decrease>
(which numerify to -1, 0, or +1).

And the "above" refers to

For components of your value
that are mutable, however, rather than comparing object identity using
C<===>, the C<eqv> operator tests whether the canonical representation
of both subvalues would be identical if we took a snapshot of them

right now and compared those (now-immutable) snapshots using C<===>

So it seems that some unspecified canonical representation is used, which means from the user perspective, the output is essentially random. I doubt that's really what we want. Any ideas for how to improve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment