Front page | perl.perl6.language |
Postings from August 2010
Smart-matching and m//
From:
Moritz Lenz
Date:
August 1, 2010 16:09
Subject:
Smart-matching and m//
Message ID:
4C55D17F.20700@gmail.com
Consider
'abc' ~~ m/b/;
By current spec this would
1) temporary set $_ = 'abc'
2) call m/b/, which matches against $_
3) produce a Match object
4) calls .ACCEPTS($_) on the Match object
5) return False
Likewise
'abc' ~~ .uc
ends up comparing 'abc' to 'ABC and return False.
I guess that's not what we want, so there might be a need for a rule
preventing the .ACCEPTS call when $_ is used on the RHS.
(The previous spec with syntactic forms kinda solved the problem, the $_
topicalization re-introduced it).
Cheers,
Moritz
--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/
-
Smart-matching and m//
by Moritz Lenz