lua-users home
lua-l archive

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

Thomas Breuel wrote:
Scheme is a great language--a language designed for computer scientists and experienced programmers to play around with new ideas. Lua is a widely used extension language for general users. Once macros are available in a programming language, readers can tell much less about what a piece of code does than if macros are not available.

Most uses of macros can be handled more cleanly with a compact lambda or block construct, plus some simple operators. I think Lua already has pretty good support for that, but maybe a more Smalltalk/Ruby-like block syntax could improve things a little further.
As someone using Lua in a performance-aware environment I'm interested in macros, not so much for the ability of redefining the core language, but for the possible performance improvements, such as conditional compilation of debug-statements:

   function f()
      debug("This should disappear in release compiles.")

I agree that lambdas can do most of what macros can do, but they fall short in terms of performance. It would be really good to be able to add debug statements, parameter checking, asserts, etc... and know that we only payed the cost of those in our debug builds.

I've considered pairing Lua with some external macro language, but the C preprocessor feels to C specific and I don't like the syntax of M4. I think the macro language would need to be lua-aware to have decent syntax. And the best of all would be hygienic macros with Lua itself as the macro language.

-- Niklas