[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Activation frame problem
- From: "Bilyk, Alex" <ABilyk@...>
- Date: Fri, 2 Apr 2004 11:18:55 -0800
I
would have to aggree here. In my scripts I use 'local' declaration pretty much
exclusively. Another thing one can do is to prohibit adding anything to global
namespace via a metatable. There is a number of ways one can control
scoping in Lua. Adding more extras for this would still not prevent people
from being slopy, ingnorant, forgetful of simply making
mistakes.
Alex
Doug Rogers
escribió:
> I will be happy when the
'global' keyword becomes the one-and-only way to make
> something
global! ;)
Will you? You would be happy
having to put:
global string,
math, io, table, ...
global type,
tonumber, tostring, ...
at the beginning
of every script?
Remember that the
compiler has no a priori way of knowing what globals might be in the
environment at the point in the indeterminate future when the script is
actually run.
And how does this work with
the standalone interpreter?
It would be
slightly more reasonable to syntactically mark all globals in some way, but I
personally don't like the look of stuff like
if $type(foo) == "table" then $table.insert(foo, 42)
end
It seems too Perl-y or
something.
There is a pre-release of my
Lua colouriser at
<http://lua-users.org/files/wiki_insecure/users/rici/parser.tgz>; this
visually marks most global errors, and some other errors as well (such as
unused locals). I apologise for the lack of documentation, but I hope to be
able to put together an alpha release this weekend.
R.