From: Rafael Garcia-Suarez Date: Sun, 4 Jun 2006 22:32:50 +0000 (+0000) Subject: The smart match table was duplicated in source code and in perlsyn, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b021f5f3b3636124de9776768d5a16528d92310;p=p5sagit%2Fp5-mst-13.2.git The smart match table was duplicated in source code and in perlsyn, so remove the one in the source code p4raw-id: //depot/perl@28349 --- diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index e8ef30f..d381f26 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -698,7 +698,9 @@ order, determines the match behaviour. + - this must be a code reference whose prototype (if present) is not "" (subs with a "" prototype are dealt with by the 'Code()' entry lower down) - * - if a circular reference is found, we fall back to referential equality + * - that is, each element matches the element of same index in the other + array. If a circular reference is found, we fall back to referential + equality. ! - either a real number, or a string that looks like a number The "matching code" doesn't represent the I matching code, diff --git a/pp_ctl.c b/pp_ctl.c index 9633ba3..929f5a2 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3768,42 +3768,8 @@ PP(pp_smartmatch) return do_smartmatch(NULL, NULL); } -/* This version of do_smartmatch() implements the following - table of smart matches: - - $a $b Type of Match Implied Matching Code - ====== ===== ===================== ============= - (overloading trumps everything) - - Code[+] Code[+] referential equality match if refaddr($a) == refaddr($b) - Any Code[+] scalar sub truth match if $b->($a) - - Hash Hash hash keys identical match if sort(keys(%$a)) ÈeqÇ sort(keys(%$b)) - Hash Array hash value slice truth match if $a->{any(@$b)} - Hash Regex hash key grep match if any(keys(%$a)) =~ /$b/ - Hash Any hash entry existence match if exists $a->{$b} - - Array Array arrays are identical[*] match if $a È~~Ç $b - Array Regex array grep match if any(@$a) =~ /$b/ - Array Num array contains number match if any($a) == $b - Array Any array contains string match if any($a) eq $b - - Any undef undefined match if !defined $a - Any Regex pattern match match if $a =~ /$b/ - Code() Code() results are equal match if $a->() eq $b->() - Any Code() simple closure truth match if $b->() (ignoring $a) - Num numish[!] numeric equality match if $a == $b - Any Str string equality match if $a eq $b - Any Num numeric equality match if $a == $b - - Any Any string equality match if $a eq $b - - - + - this must be a code reference whose prototype (if present) is not "" - (subs with a "" prototype are dealt with by the 'Code()' entry lower down) - * - if a circular reference is found, we fall back to referential equality - ! - either a real number, or a string that looks_like_number() - +/* This version of do_smartmatch() implements the + * table of smart matches that is found in perlsyn. */ STATIC OP *