[gambit-list] Error handler in 3.0

Marc Feeley feeley at IRO.UMontreal.CA
Mon Feb 14 11:57:07 EST 2005


> Is there an undocumented way to specify an error handler in Gambit
> 3.0? I mean, instead of going into a nested REPL, can Gambit run a
> function that we provide?

There is ##catch-all.  Here's how you can use it

(define (catch-all-errors thunk)
  (call-with-current-continuation
   (lambda (cont)
     (##catch-all (lambda (x args)
                    (cont "error"))
                  thunk))))

(catch-all-errors (lambda () (+ 1 (/ 2 0))))  =>  "error"

> I wrote an X11 window manager with Gambit 3.0. (It's very fast! ;-) )

Interesting...  What are the features of this window manager and do
you expect to release it?

By the way, why are you still using 3.0?  In 4.0 you could use
the documented with-exception-catcher.

Marc


More information about the Gambit-list mailing list