lua-users home
lua-l archive

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


Hi,

Mark Hamburg wrote:
> You removed lua_cpcall on the basis that it was redundant. Note, however,
> that lua_cpcall catches errors from the case where there is no room to push
> the function and the light userdata.

Umm, ok. But the only time lua_cpcall is really useful is when you
use it at the outermost frame and then only for the main thread
(i.e. only once). This cannot fail because the stack is preallocated
in lua_open (-> lua_newstate -> f_luaopen) to BASIC_STACK_SIZE (2*20
elements).

> 2. Support for "light C functions" -- i.e., functions that could be
> represented purely as TValues rather than as garbage collectable entities.

Ok, but then you have to acknowledge that the original lua_cpcall
implementation in Lua 5.0/5.1 does not do that either.

IMHO the tiny semantic change does not matter much in practice. The only
use I ever saw of lua_cpcall is in lua.c. And there it cannot happen.

Adding it back isn't too difficult. But it really only takes up code space
without a good reason. IMHO it should be removed.

Anyway, Roberto decides. I just made a few (source code) suggestions.

Bye,
     Mike