lua-users home
lua-l archive

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


On Thu, Feb 21, 2013 at 4:10 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> This all made me think that if Lua had a macro processor, turning a
> table into pre-defined locals would be pretty trivial. Something like:

There have been suggestions about e.g. 'import sin,cos from math' but
the feeling is that this is just sugar, and sugar is bad for you ;)

BTW, many of the 'nice-to-have' features that don't get into Lua have
ended up in Moonscript, which has this very statement and feels good
to use.

Macro preprocessor? I did one of those, LuaMacro. And yes, it can
happily process such a statement, so that remains an option.

What cannot be done is 'import * from T', if this is understood as
generating local aliases for the contents of T.  The contents of T is
only known at run-time, and locals have to be generated at
compile-time (or macro time)

steve d.