sábado, 12 de abril de 2008

Continuation - WTF?!?

Neste post saberemos o que é essa tal de Continuation e pra que serve. Este post foi motivado por este post de javascript, e quando comecei a pesquisar se não havia mesmo alguma implementação para Thread, ou alguma coisa parecida, em JavaScript, e me lembrei desta tal de Continuation.

Mas afinal, o que é Continuation?

Uma boa definição, e de fácil entendimento eu achei no projeto Cocoon da Apache. Na documentação de pageflow eles dizem o seguinte:

"...Think of a continuation as an object that, for a given point in your program, contains a snapshot of the stack trace, including all the local variables, and the program counter. You can not only store these things in the continuation object, but also restore the execution of the program from a continuation object. This means that the stack trace and the program counter of the running program become the ones stored in a continuation."