sorear/niecza

eqv ignores values in hashes

Closed this issue · 2 comments

<sirrobert> is there an operator (or method?) to compare if two hashes have the same keys and values?
<masak> eqv should do that.
<masak> rn: say { foo => 1, bar => 2 } eqv { bar => 2, foo => 1 }
<p6eval> rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«True␤»
<sirrobert> rn: say { foo => 1, bar => 2 } eqv { bar => 2, foo => 5 }
<p6eval> rakudo ef228d: OUTPUT«False␤»
<p6eval> ..niecza v21-15-gf226bf6: OUTPUT«True␤»
* masak submits nieczaissue
<sirrobert> sad path =)
<masak> sirrobert++

I believe Rakudo to have it right in the second evaluation. In other words, hash values should factor into eqv equivalence.

<colomon> rn: say { foo => 1, bar => 2 } cmp  { bar => 2, foo => 5 }
<p6eval> niecza v21-15-gf226bf6: OUTPUT«Same␤»
<p6eval> ..rakudo ef228d: OUTPUT«Decrease␤»
<colomon> actual bug is in cmp, I think
* masak adds that to the issue

Fixed in 55f5b8a.