lua-users home
lua-l archive

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


On Mon, Apr 28, 2014 at 1:07 AM, Jay Carlson <nop@nop.com> wrote:
> This is why you can't have $ for identifiers in Lua. I need it for sugar.
>
>   $"SELECT * FROM t WHERE group=$group AND id<>$id"

That transformation is one of the things that lexical macros can do
cleanly. In LuaMacro, '$' can be made a reader macro that looks for a
following string literal, and pulls out the dollar-fields.

(one of the old complaints about preprocessors is that they don't obey
the lexical scoping rules of variables - cpp is famous for smashing
everything in its path.  At least in LuaMacro one can define scoped
macros)