Buy GNU books!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
It is traditional in Scheme to implement exception systems using
(see section 26.5 Continuations) are such a powerful concept that any other
control mechanism -- including
throw -- can be
implemented in terms of them.
Guile does not implement
throw like this,
though. Why not? Because Guile is specifically designed to be easy to
integrate with applications written in C. In a mixed Scheme/C
environment, the concept of continuation must logically include
"what happens next" in the C parts of the application as well as the
Scheme parts, and it turns out that the only reasonable way of
implementing continuations like this is to save and restore the complete
So Guile's implementation of
call-with-current-continuation is a
stack copying one. This allows it to interact well with ordinary C
code, but means that creating and calling a continuation is slowed down
by the time that it takes to copy the C stack.
The more targeted mechanism provided by
does not need to save and restore the C stack because the
always jumps to a location higher up the stack of the code that executes
throw. Therefore Guile implements the
throw primitives independently of
call-with-current-continuation, in a way that takes advantage of
this upwards only nature of exceptions.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|