Dave Mitchell wrote: > foo() is a closure created at compile time. By the time the main {} block > has been executed (but before foo() is called), the $outer:x is undef, > and $foo:x is 'bar' (standard closure stuff). When foo() is executed, > the anon sub is cloned, and at that time, $anon:x is set from from foo's pad, > so it gets 'bar'. That explains it. I still don't like it. ;-) > (I've changed 'closure' to 'outer' since John Porter's just pointed > out to me privately that 'closure' is grammatical nonsense) > So instead, I'd like > > "my outer $x" to be shorthand for I guess you missed where I suggested that putting "my" on that declaration is also counter-sensical, not to mention redundant. "my" implies a brand-spanking-new lexical variable attached to this very scope. The semantics of "outer" (or "closed"...) can be defined to imply a lexical variable. -- John PorterThread Previous | Thread Next