This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: call-with-current-continuation


Telford Tendys <telford@triangle.triode.net.au> writes:

> > Guile currently implements its error handling with exceptions; these
> > are a very restrictive form of call/cc.  There is an explanation of
> > this in the docs.  Basically, they're more efficient than call/cc.  
> 
> Are you talking speed efficient or memory efficient?

Both, to some extent.  Here's the story:  call/cc is implemented
essentially by copying the stack.  This is expensive but necessary
because you might continue the same way many times, from anywhere.
ISTR there have been thread systems implemented using call/cc.
Exceptions, OTOH, just need to be able to unwind the stack (and call
dyn-winds).  So they don't have to make a stack copy. 

> In the case of speed, I like speed but I don't care how fast the error
> handling is because most of the time I'm not using errors. With error
> handling the prime importance is reliability and then convenience.

Well, the trick is that you have to copy the stack every time you go
into a procedure that might trap an error.  That's expensive
time-wise. 

> In the case of memory, how much difference can there be?
> What is this as a percentage of the other data structures in memory?

The stack can get big; keeping copies around is a pain. 

> 	- Tel

You should check this with somebody else; there's a doc I got all this
from, but guile has had so many different sets of docs I can't
remember which it was.  I think I still have docs from guile-iii
kicking around...

Andrew