lua-users home
lua-l archive

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


Dear Lua list,

On 11.07.2010 22:55, Roberto Ierusalimschy wrote:
Lua is a dynamic language with dynamic typing, and we do not intend to
change that.

Sorry for the naive question, but I've been following the discussions about globals, locals, etc., and I admit that I'm not able to follow all arguments and proposals, and now I'm wondering if the problem was resolved by always declaring new variables, e.g. removing/deprecating keyword "local" and introducing keyword "var" that is mandatory for all variable declarations. E.g.


var i=0;   -- "local" to the "global" scope
var k;

j=1;    -- Error, j not declared earlier

do
    var j=3;    -- local to the current do ... end scope
    k=7;        -- the k from the outer scope above
end


I certainly don't know all the ins and outs of the language, but it looks to me as if this would solve all mentioned issues with locals, globals, typos, etc. (besides breaking backward-compatibility, of course) in a rather straightforward manner?

Many thanks for all the great work and people involved with Lua, and best regards,
Carsten

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature