> On 15 Dec 2015, at 19:12, Larry Wall (via RT) <perl6-bugs-follo...@perl.org> 
> wrote:
> 
> # New Ticket Created by  Larry Wall 
> # Please include the string:  [perl #126926]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=126926 >
> 
> 
> 10:05 < TimToady> m: say 3 => 1 cmp 3 => 0
> 10:05 <+camelia> rakudo-moar 3e6cc4: OUTPUT«3 => Less => 0␤»
> 10:05 < TimToady> m: say 3 => 1 cmp 3 => 2
> 10:05 <+camelia> rakudo-moar 3e6cc4: OUTPUT«3 => Less => 2␤»
> 10:10 < TimToady> at a guess, it's comparing object identities, so the
> first one created is always less

Pair.pm already contains this since September 2015:

multi sub infix:<cmp>(Pair:D \a, Pair:D \b) {
    (a.key cmp b.key) || (a.value cmp b.value)
}

so I think this is really a precedence issue:

$ 6 'say (3 => 1) cmp (3 => 0)’
More

$ 6 'say (3 => 1) cmp (3 => 2)’

Less

Liz

Reply via email to