in reply to Re: Use of 'our' considered harmful
in thread Use of 'our' considered harmful
how about a closure where you want to use a var declared outside of the closure
Well, by definition, a closure does operate on variables outside itself... that's the whole point.
As for a closure that is based on a global variable (lexical or otherwise), I can only ask "Why would you want to do a thing like that?" If the variable is global, it sort of defeats the purpose of wrapping it up in a closure. (Otherwise you would just use local).
So yes, you could do so, but I don't think it qualifies as a Real World Example™ as per the OP. I think anything you could come up with could be wrapped up in a sub and use lexical mys, and I think it would be better that way.
- another intruder with the mooring of the heat of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Use of 'our' considered harmful
by tantarbobus (Hermit) on Sep 24, 2004 at 10:44 UTC | |
by grinder (Bishop) on Sep 24, 2004 at 10:55 UTC | |
by ikegami (Patriarch) on Sep 24, 2004 at 15:06 UTC | |
by ysth (Canon) on Sep 24, 2004 at 20:37 UTC | |
by tilly (Archbishop) on Sep 26, 2004 at 07:35 UTC | |
by tilly (Archbishop) on Sep 24, 2004 at 15:31 UTC | |
by gellyfish (Monsignor) on Sep 24, 2004 at 11:06 UTC |