Skip to content

Commit 44d6add

Browse files
author
Jan-Olof Hendig
committed
The description of eqv was slightly outdated
1 parent a5f5ca0 commit 44d6add

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/Language/operators.pod6

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,16 +1480,17 @@ the same, i.e. from the same type and (recursively) contain the same values.
14801480
say 1 eqv 2; # False
14811481
say 1 eqv 1.0; # False
14821482
1483-
For arbitrary objects this is not possible with the default C<eqv> operator.
1484-
E.g., C<eqv> will not consider two instances of the same object as being
1485-
structurally equivalent:
1483+
The default C<eqv> operator even works with arbitrary objects. E.g., C<eqv>
1484+
will consider two instances of the same object as being structurally
1485+
equivalent:
14861486
14871487
my class A {
14881488
has $.a;
14891489
}
1490-
say A.new(a => 5) eqv A.new(a => 5); #=> False
1490+
say A.new(a => 5) eqv A.new(a => 5); #=> True
14911491
1492-
To get C<eqv> semantics for objects of this class, one would need to
1492+
Although the above example works as intended the C<eqv> code has to fall back
1493+
to a slower code path in in order to do its job. One way to avoid this is to
14931494
implement an appropriate infix C<eqv> operator:
14941495
14951496
my class A {

0 commit comments

Comments
 (0)