Ben Karel on 23 Aug 2012 11:48:15 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: The case against call/cc




On Thu, Aug 23, 2012 at 2:23 PM, Mark Dominus <mjd-phillylambda@plover.com> wrote:

> I thought that since we are all continuation junkies here, we might
> find this interesting:
> http://okmij.org/ftp/continuations/against-callcc.html
>
> The article argues that call/cc is a bad core feature for a language

For those who don't know Oleg's research, and who don't read the
article, take note that Oleg is not arguing against *continuations*,
but only against this particular language feature, the so-called
"undelimited" continuation capture. He has spent a lot of time and
work investigating a related but different feature, called "delimited"
continuations, which he sees as a major improvement:

    Despite sounding pretty much alike, undelimited and delimited
    continuations are qualitatively different. Since a delimited
    continuation is a mapping between contexts, it may truly be a
    function, which returns and can be composed. Undelimited
    continuations are not true functions. Undelimited and
    delimited continuations also differ in expressiveness, and
    this difference has been proven. First-class delimited
    continuations can express any expressible computational
    effect, including exceptions and mutable state. ... The
    limited expressiveness of undelimited continuations has been
    proven by Hayo Thielecke, see the reference and the abstract
    below.

    http://okmij.org/ftp/continuations/undelimited.html#delim-vs-undelim

Oleg's web site okmij.org is a trasure trove of fascinating reading,
and I recommend it for everyone.

Another bit of relevant reading isÂhttp://www.cs.indiana.edu/~sabry/papers/yield.pdfÂwhich observes that "mainstream" versions of yield (as in Ruby, Python, C#, etc)Âamount to restricted versions of delimited continuations. The paper Revisiting Coroutines likewise shows that Lua's coroutine system can encode one-shot delimited continuations.