Summary: Continuations a la Scheme
Author: Anthony Hannan
Owner: Anthony Hannan (ajh)
Co-maintainers: <None>
PackageInfo name: <Not entered>
RSS feed:


Prerequisite: ContextCleanup-ajh.

Thanks to Andreas Raab for separating this out of an older version of ContextCleanup-ajh.

ContextTags - 'methodContext contextTag' will create a unique ContextTag object for that methodContext and hold it in its receiverMap instance variable which was previously unused. Copies of the methodContext will hold the same contextTag. Holding a contextTag instead of a context directly is safer when copying contexts (see continuations below). A context for a context tag is found in the current thread just be traversing the senders until one is found with that contextTag.

Continuations - 'Continuation current' copies thisContext stack and wraps it in a Continuation object. Also, '[:cc | ...] callCC' copies the sender stack into a Continuation and returning it. Evaluating a continuation copies the stack again and resumes that copy. The current process stack is abandoned. When a BlockContext on the stack is copied it points to copied home context if it is also on the stack.

Continuation Test Case - Thanks to Avi Bryant for writing continuation test cases (ContinuationTest and AmbTest). One test case will fail until recompiled under ClosureCompiler-ajh.