Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Unusual Closure Behaviour

by Dominus (Parson)
on Jul 14, 2001 at 07:08 UTC ( #96661=note: print w/ replies, xml ) Need Help??


in reply to (tye)Re: Unusual Closure Behaviour
in thread Unusual Closure Behaviour

Says tye:

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.

--
Mark Dominus
Perl Paraphernalia


Comment on Re: Unusual Closure Behaviour

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://96661]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-08-29 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (288 votes), past polls