# New Ticket Created by Matthew Walton # Please include the string: [perl #67100] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=67100 >
This patch moves operator infix:<leg> to the setting. S03 says it's defined in terms of cmp, so that's what this does. The old PIR implementation was slightly more complex, and I'm not sure why, but this doesn't seem to need it to pass its spectests.
>From 3cf425b693f78cae8d9bbb220b9384198a63a4fd Mon Sep 17 00:00:00 2001 From: Matthew Walton <matt...@matthew-walton.co.uk> Date: Wed, 1 Jul 2009 07:31:09 +0100 Subject: [PATCH] Move infix:<leg> to the setting. --- build/gen_junction_pir.pl | 2 +- src/builtins/cmp.pir | 10 ---------- src/setting/Operators.pm | 4 ++++ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/build/gen_junction_pir.pl b/build/gen_junction_pir.pl index e1e028d..e81e10d 100644 --- a/build/gen_junction_pir.pl +++ b/build/gen_junction_pir.pl @@ -12,7 +12,7 @@ my @binary = qw( infix:~ infix:== infix:!= infix:< infix:> infix:<= infix:>= infix:eq infix:ne infix:lt infix:gt infix:le infix:ge - infix:<=> infix:leg infix:cmp infix:=:= + infix:<=> infix:cmp infix:=:= ); my @unary = qw( diff --git a/src/builtins/cmp.pir b/src/builtins/cmp.pir index 1577a34..ddc8274 100644 --- a/src/builtins/cmp.pir +++ b/src/builtins/cmp.pir @@ -150,16 +150,6 @@ src/builtins/cmp.pir - Perl6 comparison builtins .end -.sub 'infix:leg' :multi(_,_) - .param string a - .param string b - $I0 = cmp a, b - ## Don't use a tailcall here due to RT#56448 - $P0 = 'infix:<=>'($I0, 0) - .return ($P0) -.end - - .sub 'infix:===' :multi(_,_) .param pmc a .param pmc b diff --git a/src/setting/Operators.pm b/src/setting/Operators.pm index 6ab7364..2460809 100644 --- a/src/setting/Operators.pm +++ b/src/setting/Operators.pm @@ -48,4 +48,8 @@ multi sub infix:<minmax>(@a, @b) { (@a[0] min @b[0], @a[1] max @b[1]); } +multi sub infix:<leg>($a, $b) { + ~$a cmp ~$b; +} + # vim: ft=perl6 -- 1.6.0.4