lua-users home
lua-l archive

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


> Exec summary: first class continuations are the only powerful metamechanism
> which hasn't made it into Lua, unlike in its sibling Scheme. I've always
> been slightly surprised that they didn't, as they fit quite well into Lua's
> spirit of empowering through very generic metamechanisms. I'd guess they
> reasons why they didn't are largely historical (?)

First-class continuations is not in Lua because of
coroutines. Coroutines are *much* simpler to implement (mainly if
you want an efficient implementation) and is as powerful as one-shot
continuations. Practically all useful applications of continuations
shoot a continuation at most once (so are one shot)[1]. So, coroutines
provide practically the same expressiveness of continuations at a fraction
of the cost.

  ftp://ftp.inf.puc-rio.br/pub/docs/techreports/04_15_moura.pdf


[1] Recently there has been some research in Scheme using continuations
for dynamic sites that would need multi-shot continuations (if the user
clicked the same button twice). I am still waiting to see how this
architecture behaves in practice. (There is some debate of what should
be the "correct" behavior in those situations, from the user point of
view.)

-- Roberto