lua-users home
lua-l archive

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


David Given wrote:
> And it's all so simple it might even be *fast*... calling a function will be
> fairly expensive, as it requires creating a lot of closures, but it should
> still be easy meat for LuaJIT.

IMHO you're a bit too optimistic here. It takes an awful amount
of compiler technology to reduce this to a traditional call
chain. Looking at the literature it seems the success rate is
limited, too. Not all cases can be reduced with a reasonable
amount of analysis, i.e. the compiler cops out too often.

Similar results have been found with user-definable control
structures or user-overridable primitive operations. It takes a
disproportional amount of analysis to reduce these to the common

And IMHO the pay-off is rather meager. The standard looping or
branching constructs and standard operational semantics "do it"
for most users of the language. And changes with global effects
(like redefining '+' on numbers) are generally bad for software
composability (*).

(*) Which BTW is the one thing I don't like about generic
metatables in Lua: the effects are non-local and rarely useful in
general (__index for strings is an exception).