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: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-12-16 (18:06)
From: Kevin S. Millikin <kmillikin@a...>
Subject: RE: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml
On Tuesday, December 16, 2003 9:42 AM, Kenneth Knowles 
[] wrote:

> SML/NJ is a continuation-passing style compiler, so they are trivial.
> It is "possible, even in the presence of native compilation
> exceptions," but in a traditiional call stack compilation it requires
> some sort of stack copying, making them extremely inefficient.  (in
> SML/NJ every program is slower, while continuations have almost no
> penalty)

> There may be new tricks for avoiding copying of the whole stack, but 
> wouldn't hold your breath for continuations in ocaml.

You don't *have* to copy the stack on continuation capture, just mark 
the point where the continuation was captured and seal it off.  You do 
have to copy stack frames (but not the whole stack)---on continuation 
restore or upon stack segment underflow.

Programs that use continuations are (for the most part) the ones that 
pay the price, and they pay that (bounded) price upon continuation 
invocation or returning past a captured continuation.

For details on these new tricks, you can read Hieb, Dybvig, and 
Bruggeman's 1990 PLDI paper.

Kevin S. Millikin           Architecture Technology Corporation
Research Scientist          Specialists in Computer Architecture
(952)829-5864 x162

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: