lua-users home
lua-l archive

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


On Wed, Sep 30, 2009 at 2:21 PM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> Don't you think that it would be very confusing that some code bits
> have upvalues, but others do not, all mixed up in the same file ? That
> is amplified by the fact that the 'chunk' code of the example could
> try to access outer variables, but instead of upvalues you would get
> perfectly legal global variable access, and thus no way to report that
> as an error at compile time.

Ah, but Lua does know whether a function does in fact have upvalues
once it is compiled.

The bigger problem is that the destination context where the chunk
will be run has to be compatible, so global discipline is required.
Like, explicit requires as in LuaLanes.  E.g. you may have lfs
globally available, cannot assume the chunk knows about this!

The Lua parsing issue is not an issue; the chunk is just an anonymous
function, compiled with the rest.