On 2/17/11 10:25 PM, Clark J. Wang wrote: > On Fri, Feb 18, 2011 at 8:45 AM, Chet Ramey <chet.ra...@case.edu > <mailto:chet.ra...@case.edu>> wrote: > > > The -g option exists solely to create variables at the global scope. The > intent is that functions be able to declare global variables with > attributes if they desire. It doesn't change the scoping rules or > variable resolution behavior. > > > A global var can always be declared out of a func (usually at the beginning > of the script) so what's the main intention of introducing a new `-g' option?
As I said, so functions can declare global variables with attributes. > And If we can declare/modify a global var in a func but we cannot read it > from in the func I don't think the feature is very useful to people. There are more things in heaven and earth than are dreamt of in your philosophy. How about you and I want until the folks who requested the feature weigh in on the subject. (And keep in mind that you can read a global variable from a function just fine as long as you don't interpose another local variable with the same name from a different function.) Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/