lua-users home
lua-l archive

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



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.