[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is there a kernel patch for creating local variables programmatically?
- From: Thomas Jericke <tjericke@...>
- Date: Tue, 21 May 2013 06:14:19 +0000
On 05/18/2013 08:06 PM, Dirk Laurie wrote:
As been said, this is not possible. Lua is not aware what members the
table has at compile time, locals accesses are generated at compile time
(that's why I like them so much).
In the case of 'require()' that would actually mean, that Lua must be
aware of other files at compile time, which it isn't at the moment.
Currently you can compile Lua scripts each by its own, and actually I
think that is a nice feature. I am not sure if Lua should give up this
feature for a "import *" statement. A lot of freedom to give up just to
avoid some typing.
Often on this list voices have gone up proposing a language addition
that would allow one to automate the following process:
table.concat, table.insert, table.remove, table.pack,
by saying Pythonically
from table import *
or whatever. Has anybody ever actually produced a kernel patch that
implements something of the kind?
If Lua really once will get a macro extension, it is highly possible
that such things would be possible, assuming that the Lua macro language
will run pre-compilation.