lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


----- Original Message -----
From: Russell Y. Webb <rw20@cornell.edu>
To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
Sent: Friday, September 15, 2000 6:28 PM
Subject: Re: suggestion for backwards compatible "global"


> Good idea!  I suggested it about 2 years ago and didn't get anywhere with
> it.  Perhaps times have changed...
>
> I believe my suggestion was to use "method" or "routine" as the new
keyword;
> there doesn't seem to be an entirely satisfying word available though.

If we are to allow both sematics and mark the difference with a keyword
or something of the sort, it seems much cleaner to me to simply extend
the "local" syntax. One could for instance say that

  local *

means that all assignments are local (perhaps except the onse declared
global?)

For instance:

y=1
function f (x)
   local *
   print(y)
   y = x*2
   print y
end
print(y)
f(2)

would print out 1, 4 and 1... If one wanted to add a keyword (which I guess
is
undesirable) one could perhaps write "local all" or something, which would
be prettier IMO... Although probably unacceptable...

Anyway... I must say that personally I would favour having the default be
local with only the "global" keyword available... Guess I'm just used to it

--

  Magnus Lie Hetland      (magnus at hetland dot org)

 "Reality is what refuses to disappear when you stop
  believing in it"                 -- Philip K. Dick