[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: omission in lua_yield docs
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 28 May 2012 09:24:34 -0300
> So why not explicitly state that lua_yieldk also never returns ? Is it
> an implementation detail ?
Yes. Note that it is not necessary to lua_yieldk not to return (see Lua
5.1). For instance, an alternative implementation might return if there
was nothing to unwind in the stack (that is, no C calls).
I find a little misleading the parallel between lua_yield and
lua_error. Most people expect lua_error not to return; it is something
familiar to many programmers. lua_yield is much more unusual, and it
is quite reasonable someone to expect this function to have a behavior
similar to 'coroutine.yield'. Forcing the programmer to write "return
lua_yield" is a way to make quite clear in the code that the function
yielding will not be resumed itself.
-- Roberto