In perl.git, the branch tonyc/smartmatch has been created
<http://perl5.git.perl.org/perl.git/commitdiff/d6b984c609601d8bf7401599f7e97a9451ff19f3?hp=0000000000000000000000000000000000000000>
at d6b984c609601d8bf7401599f7e97a9451ff19f3 (commit)
- Log -----------------------------------------------------------------
commit d6b984c609601d8bf7401599f7e97a9451ff19f3
Author: Tony Cook <[email protected]>
Date: Thu Jul 31 15:24:24 2014 +1000
fix $foo ~~ /re/, autoref and forbid anything not permitted
The "Smart Match 3" patch removed conversion of:
$foo ~~ /bar/
to:
$foo ~~ qr/bar/
which this change reinstates.
Also this reinstates auto-reffing of the left-hand argument so that
code like:
@foo ~~ \&bar
will call bar(\@foo).
Unfortunately this can lead to:
@foo ~~ "".\@foo
matching, since the left is auto-reffed, then stringified for comparison
with the string on the right.
Additionally, we forbid:
$foo ~~ @bar # compile-time
$foo ~~ %bar # compile-time
$foo ~~ @bar[0.1] # compile-time
$foo ~~ @bar{0.1} # compile-time
$foo ~~ $otherref # run-time, disallow any unblessed reference not
# a code or regexp
M embed.fnc
M embed.h
M op.c
M opcode.h
M pp_ctl.c
M proto.h
M regen/opcodes
M t/op/smartmatch.t
commit bd020283f9ea6eea050a33cd8520de974e1ebb30
Author: Tony Cook <[email protected]>
Date: Thu Jul 31 10:40:24 2014 +1000
add experimental smart-matching against numbers
This causes some tests to fail because $foo ~~ /bar/ is currently
broken and is treated as $foo == ($_ =~ /bar/)
M lib/warnings.pm
M pod/perldiag.pod
M pp_ctl.c
M regen/warnings.pl
M t/lib/feature/switch
M t/op/smartmatch.t
M t/op/switch.t
M warnings.h
commit 0a42de53b6b1ad2c748a19e58c99842feeee8eba
Author: Father Chrysostomos <[email protected]>
Date: Thu Sep 13 00:18:28 2012 -0700
New whirled order for givwhen/last/next
given now responds to last and next.
break only breaks out of given, and does not complain about an
inner foreach.
when and default do an implicit regular next, not a âspecialâ next
that only breaks out of foreach() and given.
M embed.fnc
M embed.h
M pod/perldiag.pod
M pp_ctl.c
M proto.h
M t/op/switch.t
commit ce68e97bdc22d96a7e45439fafe3d4888d08276f
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 12 16:33:49 2012 -0700
toke.c: use goto to reduce repetitition
I couldnât think of a name for the label that didnât just repeat what
the code was doing (increment_lex_allbrackets_and_set_PL_expect), so I
gave it an arbitrary short name.
M toke.c
commit f78ba3de038204e04650cfd57ebceed3f55778e8
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 12 00:21:12 2012 -0700
Smart Match 3â¢
I was persuaded by Smylersâ argument concerning string equivalence:
<[email protected]>
But it is not too late for me to be overruled since this is not in
blead yet.
The list is:
RHS type
1. undef
2. ~~ overloading
3. reftype eq CODE
4. reftype eq REGEXP
5. fall back to eq
One question still remains: Should undef ~~ "string" give a warning?
Currently it doesnât, but neither does it call eq overloading on the
RHS if we actually have undef ~~ $overloaded_object_without_smartmatch.
This cannot be merged until we solve the fact that smart match
is used in:
cpan/autodie/lib/Fatal.pm
cpan/autodie/t/exceptions.t
This does not deal with loop controls yet, just smartmatch and the
smartmatch aspects of of givwhen.
M embed.fnc
M embed.h
M ext/XS-APItest/t/fetch_pad_names.t
M op.c
M opcode.h
M perl.h
M perly.act
M perly.h
M perly.tab
M perly.y
M pod/perldiag.pod
M pp_ctl.c
M proto.h
M regen/opcodes
M t/op/smartmatch.t
M t/op/switch.t
M t/op/taint.t
M toke.c
-----------------------------------------------------------------------
--
Perl5 Master Repository