lua-users home
lua-l archive

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


* Mike Pall:

> I guess it would be easiest to do this in the parser. Whenever a
> chain of table lookups starting with a global is made, do this
> lookup in parallel on the global environment which is active during
> parsing. If the endpoint of the lookup is one of the builtin
> functions, put it into the constant table and emit a simple load
> from the constant table (instead of the chain of table lookups).

Or you could perform a special metatable lookup ("__compileindex", but
this would still have to be controlled by a flag).  If you figure out
how to pass context from the compilation to the metamethod, you've got
a macro system (it's probably closer to Forth immediate words,
though).