Monday, November 20, 2006

Continuations for Web Development and Leaky Abstractions

In the popular online essay The Law of Leaky Abstractions Joel Sopolsky talks about choosing wrong abstractions for describing programing libraries. Abstractions that hide details influencing in important ways the programs using those libraries. Since those details are hidden the programmer have no control over them and in result has no control over important aspects of the resulting programs.

Calling something continuation passing when in fact you need to save and then retrieve the whole process memory to and from the disc is such a misleading abstraction. Passing and then calling a continuation, in languages that support it, is a primitive operation - something that translates to just a few machine code instructions - something O(1) - saving process memory is not. Until this memory saving is completely eliminated I will call Catalyst::Continuation and Jifty::Continuation a leaky abstraction.