in reply to (tye)Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour
First, neither of those are closures. They are both examples of static variables and named
functions. The term "closure" refers to a code reference that also carries along some
variables. In neither of these case is the $x being carried around in a code reference (in
part because no code references are being used).
There is indeed code reference. It is stored in
the symbol table for the main package. It points
to a CV, just like any other code reference,
and the CV has a pointer to the pad, which does
have the $x variable captured in it, just like
any other closure.
So yes, it is a closure.