lua-users home
lua-l archive

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


On Sat, May 05, 2001 at 02:43:25AM -0700, Paul Hsieh wrote:
> Actually, now that I've thought about both a little more carefully,
> I realize, that the LISP version is actually somewhat faster, since
> it does not need to *REPARSE* the "macros" from scratch; they have
> already been at least tokenized before execution time.  So its the
> same power, but somewhat slower in Lua.

I'm still not convinced that dostring has the same power as LISP
macros. (Disclaimer: I am not a LISP expert.) For starters, dostring
does not honor scope. Consider, for example:

lua>>> function a() \
lua... local b = 123 \
lua... dostring("print(b + 2)")\
lua... end
lua>>> a()

This won't work, while to the best of my knowledge, LISP macros handle
this situation just fine. Another problem is that if you define
functions in the dostring() call, these end up in the global scope,
which often is very undesirable. I see no way to force them to use
local scope, instead.

- Christian