***'''http://www.magicsplat.com/blog/coro-iterate/%|%Recursion to Iteration via Coroutines%|%'''*** '''Ashok P. Nadkarni''' 2017-09-10 Many programming tasks are very simply expressed and implemented through recursive algorithms, traversing a tree data structure being just one example. The primary reason recursion simplifies implementation is that the state of the computation is implicitly maintained, freeing the programmer from the burden of explicitly tracking the computational state of the program. For example, in a recursive tree walking implementation, the "current location" in the tree is implicitly tracked. However, there are situations where a recursive model does not fit the needs of an application. For example, the application may want to traverse a tree in iterative fashion, retrieving one node at a time, operating on it and then potentially doing some unrelated computation before retrieving the next node at some unknown point in the future. Here is where coroutines can bridge the impendance mismatch, presenting an iterative interface to a naturally recursive algorithm http://www.magicsplat.com/blog/coro-iterate/%|%more ...%|% <
> ***'''http://www.magicsplat.com/blog/disassemble/%|%Exploring Tcl internals from script - Part II%|%'''*** '''Ashok P. Nadkarni''' 2017-08-04 A previous blog post described the representation command and its use for introspecting Tcl's internal structures for storing data. I promised a follow-up post that talked about Tcl's compiled byte code and the disassemble command for inspecting it. Well, only two years later, here is that post as promised http://www.magicsplat.com/blog/disassemble/%|%more ...%|% <
> ***'''http://www.magicsplat.com/blog/promise-error-handling/%|%Exception handling in promises%|%'''*** '''Ashok P. Nadkarni''' 2016-01-23 In a http://www.magicsplat.com/blog/promises-by-example/%|%prior post%|% I had illustrated the use of the Tcl '''promise''' package for asynchronous computing with some examples. There we had ignored the possibility of errors and exceptions and how they are handled in promise-based code. In this post, we build on the examples in that post to illustrate how promises greatly simplify handling of errors in async code http://www.magicsplat.com/blog/promise-error-handling/%|%more ...%|% <
> ***'''http://www.magicsplat.com/blog/promises-by-example/%|%Promises by example%|%'''*** '''Ashok P. Nadkarni''' 2016-01-20 I had previously described an experimental implementation of promises for Tcl. On re-reading my earlier post, I was somewhat dissatisfied with the treatment there in that I did not feel it fully reflected the value of the promise abstraction, getting somewhat caught up in the details. This post takes a somewhat different approach, concentrating more on examples and refraining from going into detail about each command or method. Here I am more interested giving you a flavor of programming with promises and motivating you to explore further.