develooper Front page | perl.perl6.language | Postings from May 2005

Re: C<::> in rules

Thread Previous | Thread Next
Luke Palmer
May 13, 2005 21:26
Re: C<::> in rules
Message ID:
On 5/14/05, Larry Wall <> wrote:
> On Sat, May 14, 2005 at 01:15:36AM +0000, Luke Palmer wrote:
> : I think the misunderstanding is rather simple.  You keep talking like
> : you prepend a .*? to the rule we're matching.  I think that's wrong
> : (and this is where I'm making a design call, so we can dispute on this
> : once we're clear that it's this that is being disputed).  I think
> : there is a special rule:
> :
> :     rule matchanywhere($rx) { .*? <$rx> }
> :
> : Which makes a *subrule call* to the rule we're matching.  Therefore
> : ::: just breaks out of that subrule, and backtracks into the .*?
> : again.
> I want ::: to break out of *that* dynamic scope (or the equivalent
> "matchrighthere" scope), but not ::.

I'm not sure that's such a good idea.  When you say:

    rule foo() { a* ::: b }

You know precisely where that ::: is going to take you: right out of
the rule.  That's the way it works in grammars, and there's no
implicit anything else that you're breaking out of.  But you're saying
that when we use a bare // matching a string, that's no longer the
case?  In other words, this:

    $str ~~ / a* ::: b /

Is different from:

    $str ~~ / <foo> /

That seems like a pretty obvious indirection, and a mistake to break
it.  There's nothing there except <foo>, how could it act differently?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About