lua-users home
lua-l archive

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




I know that Seaside does. It uses continuations to 'remember where it was'
when the user backs up through a series of forms. e.g., given code similar to
this:


For that kind of thing, you should look at OCaml's replay debugger: it uses POSIX fork(), which does copy-on-write, to put 'time bookmarks' in the debugged program. The result is, you can run your program under debug backward as well as forward (which is insanely cool to use, BTW). That's a neat way to put continuations in a language that doesn't support them.

Another, portable approach would be to write a 'clone thread stack' function, which could be a separate library. Wrap it in a callcc() API if you like.

As for whether it's a good idea to add real continuations, I seriously doubt it. It would definitely sound cool, but there aren't that many cases where it's worth it. Moreover, continuations work well in a functional environment, but Lua encourages a rather imperative style, and continuations become really messy when there are a lot of shared states between k()s.

I've also been wondering whether a continuation monad would help keeping such code maintainable, but even some PhDs have a hard time with that stuff :)

-- Fabien.