Jacques Klein's Tcl Page

jacques.klei - a t - googlemail.com

Project: Tcl Continuations

Continuation is a powerful language feature, that can help to solve in simple and elegant ways some kind of programming tasks... Tcl doesn't provide it yet, nor is it's current implementation "adapted" for an easy "addition" of it....

Several years ago, I implemented some sort of continuation in the Tcl 7.3 version. Some months later I found in the Internet an other implementation of continuation based on Tcl 7.5 called AgentTcl; I didn't try to understand how it was done, my impl. worked for me.

Some years later, I had a look at the Tcl 8.x versions and discovered the switch from "pure strings" to the "Tcl_Obj" and also the "byte-compiler"; this didn't inspire me much to "reimplement continuations"....

This summer (2006), I made a "real try", first beginning with a "pure tcl" way-of-doing, based on "code intrumentation" (but soon I realized that this wouldn't be satifying for a "strong" and "truly useable" feature), followed by an attempt to do it as a Tcl Extension. This was better looking from the "application side" (tcl scripting), but "too bad" regarding the C code (too much duplication of Tcl core code, no chance to be maintained...). Finally I came up with an impl. as Extension requiring some changes in the Tcl C core.

New (March 2008): First-class Continuation Objects
The May 2006 cnt implementation wasn't satisfying, so in January 2008, I began to think about a better way of doing.
The rest of this page describes the current state of this new implementation.

My objectives, ordered by importance:

Prototype impl.


How-To-Make the 8.4.14 version (well, how I made it).

Be warned, I only made all this on a linux box [Red Hat Linux]
using gcc version 3.4.6 20060404 (Red Hat 3.4.6-3).