[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua locals
- From: rw20@...
- Date: Thu, 13 Nov 1997 09:02:00 -0500 (EST)
let me first say that Lua is a great language. I agree with almost every
design choice that's gone into it. The exception is the use of
'local'. Perhaps I'm missing something, but I think having a keyword
called 'global' would have been better. Writing 'global x' would give
you access to the global 'x'; writing 'global x=3' would assign/define
the global. Otherwise all references would be local.
Currently, 'local' is needed in front of almost every variable in a
function and I've had several hard to track down bugs from inadvertant
It's obviously too late to change Lua, but what about a function
declaration (called 'method' maybe) that defaults to local and requires
the use of the 'global' keyword to get outside the scope of the method.
So, you have
i='erer' --- global 'i' is unchanged
Just some thoughts,