On Tue, Mar 01, 2005 at 11:06:17PM -0600, Rod Adams wrote:
: Since the line between rules and subs is already blurring significantly, 
: I want to blur it a little more. I want to write rules which can take 
: parameters.

No problem.  That's how the arguments to rules like <before foo> are
already passed.  If I recall, we originally specified three basic forms:

    <foo bar>   # bar is pattern
    <foo: bar>  # bar is string
    <foo(bar)>  # bar is Perl expression

though the middle one of those is the weakest, since it's equivalent to

    <foo('bar')>

For that matter, the first one is just

    <foo(/bar/)>

Anyway, these forms are somewhat negotiable yet.  In recognition that
these are all methods underneath, I seem to recall switching the most
generic form to

    <.foo()>

at some point, but I could be hallucinating.  We could certaintly just
get by with

    <foo pattern>

and

    <.foo(@arguments)>

But I kind of like the sub syntax even if they're really methods underneath.
I dunno...

Of course, one can call them like ordinary methods too, as long as one
supplies an appropriate pattern-matching context invocant.  But it's
pretty handy to have that magically supplied for you inside <...>.

Larry

Reply via email to