APN 2013-06-28: Finally figured the way to understand coroutine-based programming was (as always) to sit and actually write some real code. The result is the fiber package.
- official reference
From the introduction of the package (with some changes):
- This package provides an implementation of "fibers" for Tcl. Fibers, as the term is used in this package, are threads (figuratively speaking) of execution that are co-operatively multitasked and use message passing as their primary means of communication, including channel-based I/O.
- Fibers are implemented using Tcl coroutines and are compatible with any Tcl application model provided it runs the Tcl event loop.
- Erlang programmers may find some similarity to that language's process model. That is not just happenstance.
SimonJones - 2016-01-14 00:22:18
Wow. I come back to a spot of Tcl after ten years or so and its coroutines, anonymous functions, tcl:oo ( which is just lovely btw ), futures ( how did I miss the comm package ) .... and fibers. Really neat. I look forward to playing with that in more detail.