lua-users home
lua-l archive

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


> I agree the two points are the same in that a yield/resume must have a
> right continuation. But the reason why I made the separation of the
> problems is that I do not think the continuation has to be in the form
> of a C function-pointer.
> 
> I think the continuation could be a virtual one defined by some
> "rules." After all, Lua 5.1 has already done so for the old
> lua_yield(...), where the continuation is a no-op and the rule is "a
> yield be called only when immediately before returning-from-C-to-Lua",
> and C-function form is also a rule-based continuation (comparing to a
> "real" continuation - stack plus program counter).
> 
> So my mental experiment is to have that rule expand to
> lua_call/lua_pcall. Would you think that is an idea making sense? Not
> for a real proposal but just want to straighten my understanding for
> further thought.

For this particular rule (no continuation), yes, it makes complete
sense. It would correspond exactly to a tail call in C: lua_tailcall.
A tail call is exactly a call with no continuation in the calling
function.

-- Roberto