[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: local by default
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Fri, 12 Jan 2007 14:55:50 -0500
David Given wrote:
> 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
> But if you want the full discussion, I'd suggest checking out
> the list archives.
There has been a few good explanations in that topic iirc (check
preceding and following posts, that one has some particularly
I remember that the conclusion was something like: global by default is
bad, local by default is much worse.