This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

R6RS exceptions


Hello,

does or will Kawa support R6RS style exception handling?  

I'd like to use with-exception-handler to implement a debugger which is
invoked in the dynamic extend of the error, ie. the stack-frames which
caused the error are still alive so that local variables can be
inspected.  The debugger is supposed to work like the Emacs Lisp
debugger when `debug-on-error' is set.

There is an implementation in srfi34.scm which looks so:

  (define (with-exception-handler handler thunk)
    (try-catch
     (thunk)
     (ex <raise-object-exception> (handler (*:.value ex)))
     (ex <java.lang.Throwable> (handler ex))))

  (define (raise obj)
    (primitive-throw (make <raise-object-exception> obj)))

unfortunately this unwinds the stack before invoking the handler, which
is what I'd like to avoid.  If I read the R6RS correctly, raise
shouldn't unwind the stack but should instead call the current handler.
(The handler can unwind the stack, but it could also invoke a debugger.)

The throw/catch idiom is of course used by most/all Java libraries, but
from a debugger perspective that's rather unfortunate, because this
throws away a lot of interesting information.  The Kawa compiler emits
enough debugging information so that the stacktraces included in
exceptions are useful, but inspecting the stack would be even better.

So, will you change with-exception-handler in the future?
Or do you know another way to implement "debug-on-error"?

Helmut.


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