On Jul 16, 2008, at 1:28 PM, Patrick R. Michaud wrote:
On Wed, Jul 16, 2008 at 11:20:28AM -0500, Chris Fields wrote:
I have submitted a simple 'match' implementation for rakudo (method
version of m//, RT#56970) and ran into an odd issue. The current
version of match which works uses a tail call:
.sub 'match' :method
.param pmc x
.return x.ACCEPTS(self)
.end
.ACCEPTS should be calling .match, not vice-versa.
Okay, though ACCEPTS is currently defined in Code.pir (REJECTS as
well). Would calling .match pertain to all executable blocks, or
should we have a Regex-specific ACCEPTS that calls .match?
BTW (and a bit OT, but probably related to the above), Rakudo
currently indicates a regex is a Block, not a Regex; haven't looked at
it in detail and don't know if it's worth worrying about for now.
> say /foo/.WHAT
Block
Essentially the difference is that smart-match sets $/, while
a simple call to .match probably should not.
Pm
I can have .match not set $/ for now and simply return matches based
on context (though I haven't messed with context much). If we get
some clarification about whether .match should set $/ we can always
change it later.
chris