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
Re: Recursion, exception and continuations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Didier.Remy@i...
Subject: Re: Recursion, exception and continuations

>  It doesn't matter if the continuation is used in a program or in
> *one* toplevel statement, but there is a problem if a toplevel statement
> produces a continuation used in an other toplevel statement: the type
> system can be broken or the extend of the continuation must be
> constrained... See SML of New Jersey for correction attempts!

These problems have been studied in [1]. The conclusion was that
typechecking continuations is not a problem, even in the presence of a
toplevel, provided the right approach is taken. 

We also found very few good example of uses of continuations, aside the
implementation of corountines.  But this application of continuations is now
subsumed by threads in caml special light.

> PS: some continuation constructs have been proposed with different
> scope, extend and typing rules and without the toplevel problem,
> but there are not the Scheme callcc operator. Some of them can be
> expansed in a CPS program of rather the same size (read papers
>  by Olivier Danvy & all).

The zoology of continuation operators is also  studied in [1] in the
presence of a strongly typed system. 

   -Didier Remy.


    Carl A. Gunter, Didier Rémy, Jon G. Riecke. "A Generalization of
    Exceptions and Control in ML". LFP'95, January 1995. 

    We add functional continuations and prompts to a language with an
    ML-style type system.  The operators significantly extend and
    simplify the control operators in SML/NJ, and can be themselves
    used to implement (simple) exceptions.  We prove that well-typed
    terms never produce run-time type errors and give a module for
    implementing them in the latest version of SML/NJ.
    (The code of the appendix is avalaible <A HREF="">here</A>)