lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> Maybe a (partial?) solution to the implicit global problem would be to
> follow the style of strict.lua, but at compile time. There would be
> only one rule:

Yes, I think that would be a good change (and _much_ better than all
this "implicit local" silliness)....

> To use a global inside a function, you may need to "declare" it. If the
> global belongs to the chunk, a simple "name = nil" in the global level
> will do.  Otherwise you may use something like "name = name". It is
> strange, but it is (or should be) uncommon for a function to mess with
> globals declared elsewhere.

Personally I'd favor a real declaration syntax of some sort
(e.g. "global VAR"), but I guess you're loathe to add a new keyword...

Heh, how about:

   not local VAR

... doesn't add any new keywords... :-)

-Miles

-- 
Immortality, n.  A toy which people cry for, And on their knees apply for,
      Dispute, contend and lie for, And if allowed Would be right proud
      Eternally to die for.