lua-users home
lua-l archive

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

>Just some clarifications: I assume that 'global in T' is a pure lexical
>declaration and not the same as 'globals(T)'.  Right?

Yes, it's purely lexical.

>And the other one: is 'global in nil' detected at compile time and
>gives errors for undeclared variables? (At least in this special form
>where nil is explicitely given?)

Yes, it's detected at compile time.

>I'm not sure if the global statement is the right thing.

It's a new thing, and certainly not simple (or at least capable of being used
in quite complicated ways), but we thing it does address a need. Or doesn't it?
(The only snag right now is the need for "predeclarations".) Like all new things
it will take some time until we really know how useful it is. So, let's hear
about possible applications and suggestions.

>And at last: it doesn't make the lanugage easier...

The default remains easy (globals do not need declaration).
The "global" declaration is for sophisticated uses, but I don't think it makes
the language more difficult: it just let's you do complicated scope control.