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: feature?


Lynn Winebarger <owinebar@free-expression.org> writes:

> Would anyone else be interested in having guile return a continuation
> if it recieves an interrupt signal?  I've been doing some stuff with it
> that makes my system go swap-crazy, and I'd like to be able to stop it in
> the middle of the computation, look at what it's doing, and then restart
> it from there.

Three weeks ago I asked about such a feature.  So I would be
interested.  On the other hand, it may be non-trivial.  Here, the
answer by Telford Tendys:

#  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

Nicolas.

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