On Fri, May 06, 2005 at 01:26:10PM -0400, Rob Kinyon wrote:
: > : Does this mean that @{foo()} can be written as @ foo()?
: >
: > I would prefer not. Use foo()[] instead.
:
: Does this mean that some constructs in Perl are parsed immediately
: (such as foo() ...) and some are deferred (such as the [ in [>>+^<<]
: ...)? I would think this potentially makes a difference in how P6 code
: is read ...
I don't believe that [>>+^<<] does deferred parsing. Reduction
operators are not a fancy form of eval. Like symbolic refs, they're
a factoring out of something that would otherwise have to be done
by eval. Basically, they're emulating what
@x.join(" $op ").eval
*would* do, which is why [<] and [|] can work. But that's because the
list-associative operators actually have some kind of listy interface
for the general reduction code to call, or else they have special
code to bypass the left-associativity of the na�ve solution.
Larry