This is the mail archive of the guile@sourceware.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: Question: resume after error or break?


On Tue, Feb 29, 2000 at 12:16:29PM +0100, Nicolas Neuss wrote:
> Hello,
> 
> Is there a possibility to resume operation of a Scheme program if one
> has stopped it with C-c or after an error?  It looks natural, but I
> didn't find anything in the manual.

I doubt that it is possible, a longjmp() call is used for errors and it
isn't usually reversable. The documentation for setjmp() and longjmp()
doesn't make it clear what happens when you try pinging back and forth
between two of them but my guess is that it fails.

However the call/cc system is better because it makes a full copy of the
stack so you can be sure that everything will be available next time
you want it. I suggest that you find a logical division in your calculation
and then use call/cc to get a continuation which you can jam into a global
variable. Don't do this too often or the garbage collector will eat all your
time but do it often enough that you can restart without too much lost
calculation.

Another alternative is to replace the normal error handler with one that
piles MORE on the stack rather than the standard one which drops back.
Some LISP systems and some other schemes do this, I'm sure it wouldn't be
hard to write one like this for guile. What basically happens is that a
new REPL is started on top of the existing calculations so that you are
still at the same place inside the calculations. On a good day you can
debug back down the stack that you are sitting on, change a few variables
and set it going again.

	- Tel

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