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

Re: Returning from Rules

Thread Previous
From:
Smylers
Date:
May 3, 2004 03:27
Subject:
Re: Returning from Rules
Message ID:
slrnc9c6e6.9vn.Smylers@stripey.com
Luke Palmer writes:

>     <{ get_rule() }>    # call an anonymous rule returned by the code block
> 
> Can also be written:
> 
>     <$( get_rule() )>
> 
> Therefore, the first syntax can be redefined to evaluate the code block
> and assign the result to $0.  The example now becomes:
> 
>     rule list {
>         <?term> , <?list>  <{ make_node('list', $?term, $?list) }>
>       | <?term>            <{ $?term }>
>     }
> 
> My argument for using this notation stems from the fact that it would
> be a royal pain to write subs like:
> 
>     sub add ($a, $b) {
>         $RET = $a + $b;
>     }

This sounds sensible to me -- not something I'd normally bother saying
(a surprisingly high number of the mails on this list sound sensible to
me), but I thought this could do with some deWarnockization ...

Smylers


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About