Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
callcc/cps-style programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-11 (17:32)
From: Chet Murthy <chet@w...>
Subject: Re: callcc/cps-style programming

Hmm ... I'm not sure I believe this.  I worked a lot with SML/NJ, and
aside from using continuations to implement lightweight threading, and
using them to do backtracking, there were really no good uses for

We can dispatch backtracking quite easily -- in modern main-line
business and scientific applications, naive use of backtracking (which
is all that call/cc really buys you) isn't really very useful.  It's
about as useful as constraint logic programming was to operations
research.  I'm talking about economic utility -- helping problems that
matter to somebody with either money, or lives, to save.

[It's not that logic-programming doesn't have its place -- certainly,
business-rule systems could benefit from a healthy dose of
logic-programming rigor -- but rather that naive application of
techniques from programming-language research almost always falls on
its sword.  It takes a pretty careful application of all this advanced
research, to "get it right".  Witness that out of all the
implementation of ML, only CAML-Light really is fast enough, small
enough, and portable enough, to be worth bothering with.  That's a
stunning failure rate, considering how many different ML
implementations there are out there.]

As for lightweight threading, well, it's nice that you can implement
them with continuations, but the real purpose of threading is to
interface with some external source of events.  Every such source
(except for the lowest-level X windows protocol) requires operating
system-level thread-contexts, so you'll end up needing heavyweight
threads anyway.

Finally, well, as Ousterhout noted in his seminal paper on events
vs. threads, there are rarely any good reasons to use threads, if you
have sufficient abstraction power (closures!) in your language.

So, well, no, I guess I don't really see how call/cc would be a good
thing to add to CAML, or, for that matter, to any language.

I can understand that it's very useful in academic languages, like
Scheme or SML/NJ.  But for languages that (perhaps also) aspire to
real-world use, and to solving problems posed from outside the world
of programming-language semantics, well, I greatly doubt that call/cc
is a good thing.


>>>>> "SB" == STARYNKEVITCH Basile <> writes:
>>>>> "Joe" == Joe Lisp <> writes:

    Joe> Is anyone working on callcc for OCaml?

    SB> I am not working on it (although I would like to...)

    SB> However, adding explicit continuations to Ocaml is an
    SB> important task: