in reply to Re^3: "our" versus "my" for class data
in thread "our" versus "my" for class data
A closure closes over the current lexical environment. That does not mean that the current lexical environment is private, whatever else shares it can change it. Frequently nothing else shares that environment, but not always. An extreme demonstrating being a function that returns several connected closures - each of which can change the private data that the others look at. (I've done this, but more often in JavaScript than in Perl. It can be a nice technique to use to coordinate between UI elements.)
In the case of our, the current lexical environment includes the fact that certain variables are actually the equivalent package variable. In that case the current lexical environment includes some very non-private stuff. So yes, our creates a closure, but not one that acts a lot like what you'd normally think of as a closure.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: "our" versus "my" for class data
by revdiablo (Prior) on Aug 08, 2004 at 18:23 UTC |