lua-users home
lua-l archive

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


In my case -- a component system -- all variables are local. The host application sets some globals at startup, but the components themselves are only allowed to
use local values. In this case, typing 'local var' every time is silly.

Jason
379



Terence Martin wrote:

Depending on your POV, you might think that defaulting to local is cleaner
because experience with other languages tends to make your brain think that
"int i" in a function isn't going anywhere else, and you have to go out of
your way to declare "i" in such a way that it's global.

Or you could think that defaulting to global is cleaner because it forces
you to explicitely make things that should be local local, which is probably
an aid to readability or something.

Personally, I can see the utility in it both ways, depending on how you want
to use the language. Which is why my opinion is that if anything does
change, it would be cool if you could work it either way, if it could be
done without a severe impact on speed and such.