Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor infix:<===> to be built using a new Niecza::ValueIdentity su…

…b, which can take Mu arguments. Then use Niecza::ValueIdentity where we were previously using infix:<===> in infix:<cmp>.
  • Loading branch information...
commit 834f2d94cbdc816c7b35f62369963d6e03df49bc 1 parent f8c5ab8
@colomon colomon authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/CORE.setting
View
6 lib/CORE.setting
@@ -1278,12 +1278,14 @@ sub trim-leading($string) is pure { $string.trim-leading };
sub trim-trailing($string) is pure { $string.trim-trailing };
sub trim($string) is pure { $string.trim };
-sub infix:<===>($l, $r) is equiv<==> {
+sub Niecza::ValueIdentity(Mu $l, Mu $r) {
my $lw = $l.WHICH;
my $rw = $r.WHICH;
Q:CgOp { (box Bool (compare == (@ {$lw.ref}) (@ {$rw.ref}))) } &&
$lw.str eq $rw.str
}
+sub infix:<===>($l, $r) is equiv<==> { Niecza::ValueIdentity($l, $r) }
+
sub infix:<=:=>(\l,\r) is equiv<==> { Q:CgOp {
(box Bool (compare == {l} {r}))
} }
@@ -3196,7 +3198,7 @@ sub infix:<cmp> is equiv<leg> (Mu $a, Mu $b) {
}
return ($a ~~ Real ?? "Real" !! $a.WHAT.gist) leg
($b ~~ Real ?? "Real" !! $b.WHAT.gist)
- unless $a.WHAT.gist eq $b.WHAT.gist;
+ unless Niecza::ValueIdentity($a.WHAT, $b.WHAT);
return 0 if !$a.defined && !$b.defined;
return $a leg $b if $a ~~ Str;
return $a.key cmp $b.key || $a.value cmp $b.value if $a ~~ Pair;
Please sign in to comment.
Something went wrong with that request. Please try again.