Saturday, August 05, 2006

Some interesting aspects of programming : Continuations

If you think about what a program performs, we start with an input and events to deal with.
Based on a certain combination of those we will
    -> perform computation
    -> feed the results to other functions who will themselves do the same
So that in concept, we deal with a graph of control flow, and programming is finding a way to transcript that control flow correctly.

Good programming is about to do it in a way that maximise the signal to noise ratio, maximizing expressivenes, and minimizing the plumbering.

The usual programming langage are "stack based", aka they implicitly gives back computed results to the caller. This implicit and uncontrollable link leads to problems when you want to spread a result in different places, as your graph requires, or decide to deliver the results based on a particular event, like what happens with GUI and generally asynchronous programming (exemple)

That's why continuations, by separating computations from the control flow, are sometimes useful.

Technorati Tags: , ,


Post a Comment

<< Home