On Fri, Jul 11, 2008 at 04:49:55PM -0400, Bob Rogers wrote:
> Based on what Bob has been saying, I can't now think of a case where
> an inner closure _shouldn't_ go ahead and have its outer_ctx set
> whenever an outer sub is invoked . . .
>
> <honk>Foul!</honk> That's exactly what r28763 does to break my code.
Okay, I give up. I don't see exactly how
.sub 'outer'
.const 'Sub' inner_sub = 'inner'
inner_sub.'capture'()
...
is substantially different from
.sub 'outer'
.const 'Sub' inner_sub = 'inner_sub'
$P0 = newclosure inner_sub
set_global 'inner', $P0
...
In each case, the capture is occurring at the beginning
of the outer sub invocation, and the 'inner' symbol table
entry points to a Closure that has 'outer' as its outer context.
Also, the Perl 5 examples you're providing don't really help me
understand the issues much, as I've never done a lot of work with
closures in Perl 5, they don't map exactly to Perl 6, and Perl 5's
notion of symbol table handling is a fair bit different from Parrot
and Perl 6. I really need to see examples of PIR that don't work,
or to have the Perl 5 translated into what you think the equivalent
PIR should be.
Pm