in reply to Re: Ugly ways to declare global variables?
in thread Ugly ways to declare global variables?
There's an implied "that you can use" modifying phrase there that you're not using.
When you use "our" to declare a global variable under strictures, you are getting a "new variable out of it" that you can use. Without the "our" declaration (or the old "use vars" declaration), you cannot use the variable - the program does not run because of this. With the "our" declaration, you now can use the variable - it's syntactically as if it were a new variable. Which it mostly is - it's a new entry in the symbol table.
The fact that, under the covers, all that "our" does is set up a value in a global symbol table such that strict doesn't complain, is really not that important. That's just an implementation detail. The syntactical sugar of "our" is a huge level of abstraction that allows people to think they're getting a new variable, and, under strictures, not be too far off the real effect.
(++ for the uglier way to do it. Ewww! :-})
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ugly ways to declare global variables?
by Roy Johnson (Monsignor) on Apr 25, 2005 at 18:24 UTC | |
by tlm (Prior) on Apr 29, 2005 at 05:30 UTC | |
by Roy Johnson (Monsignor) on Apr 29, 2005 at 15:03 UTC |