Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Nothing associated with [the temporary use of localise] persists beyond the lexical scope in which the aliasing is performed. I disagree. In my understanding, the dynamic scope of a function in respect of package (or global) variables extends to all functions called by the function, in contrast to lexical scope, which is, well, lexical. So in the example code below, the function G() can exercise "spooky action at a distance" on data localized in the F() function because G() executes within the dynamic scope of F(). One may say that this effect may be avoided by remembering to carefully localize all package variables in all called functions, but this is just the sort of 'care' that one so often forgets to exercise in one's own behalf, to say nothing of all the other stumblebums out there. IOW, not using global variables is very well-founded paranoia: sometimes those globals really are out to get you! There's a place for globals, gotos, and a host of other 'questionable' programming constructs, but they should always be approached accompanied by a healthy dose of paranoia.
In reply to Re^3: aliasing arrays using typeglob under strict
by AnomalousMonk
|
|