lua-users home
lua-l archive

Re: local by default

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


Matt Campbell wrote:
[...]
> What is the position of the Lua team on making variables local by
> default when they are assigned within a function without being
> explicitly declared? Is the team considering this change for a future
> version of Lua, or will the "local" keyword always be required? Also,
> are any local-by-default patches available for Lua 5.x? Thanks.
This shows up periodically on the list. I am not a member of the team, but I
believe the general consensus is that it's not a good idea, because:
function increment_i()
 i = i + 1 -- this doesn't do what you expect
end
But if you want the full discussion, I'd suggest checking out the list archives.
-- 
┌── dg@cowlark.com ─── http://www.cowlark.com ───────────────────
│ "USER'S MANUAL VERSION 1.0: The information presented in this
│ publication has been carefully for reliability." --- anonymous computer
│ hardware manual

Attachment: signature.asc
Description: OpenPGP digital signature


AltStyle によって変換されたページ (->オリジナル) /