[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: first class ':'
- From: David Manura <dm.lua@...>
- Date: Wed, 16 Sep 2009 02:04:18 -0400
On Mon, Sep 14, 2009 at 8:45 PM, David Manura wrote:
> we would need to make  like  but not introduce a new stack level.
> Currently, Lua lacks a documented way to express that type of currying
Related to this, sometimes I'd like to be able to call a function
without increasing the stack level. For example, let f be a function
that internally deals with stack levels:
function f() error("opps", 2) end -- or setfenv, debug.getinfo, etc.
Now say I want to wrap f inside another function:
-- a function decorator that adds trace statements.
f = trace(f)
This is not possible to do correctly because the wrapper increases the
stack level. Maybe some special "call" function (in the form of
pcall) could be implemented to call a given function within the
current stack level.