[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: local by default
- From: David Given <dg@...>
- Date: Fri, 12 Jan 2007 20:25:12 +0000
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