This seems to be working:
(define-syntax common:handle-exceptions
(syntax-rules ()
((_ exn errstmt body ...)
(begin body ...))))
I was hung up trying variations on this:
(define-syntax common:handle-exceptions
(syntax-rules ()
((_ exn errstmt ...)
(begin ...))))
which does NOT work. I guess a placeholder is needed for the first
statement captured by the ellipsis.
On Wed, Mar 15, 2017 at 1:05 PM, Matt Welland <[email protected]> wrote:
I have many exception handlers, mostly handle-exceptions but some
condition-case, and I'd like to run some tests and turn OFF the
exception handling. I tried using a proc but that does not work:
(define (mt-faux-handle-exceptions exn alt . cmds)
(let ((alt-proc (lambda ()
(let ((exn exn))
alt))))
(apply lambda '() cmds)))
The exn variable is not seen by the alt code and a "Error: unbound
variable: exn" message is issued.
I've tried a macro but I don't know enough to make it work. This
starting point works:
(define-syntax common:handle-exceptions
(syntax-rules ()
((_ exn-in errstmt ...)
(handle-exceptions exn-in errstmt ...))))
But I run into trouble as soon as I try to replace the actual
handle-exceptions with something else.
Is there any built-in switchable on/off exception handler or does
someone have a macro they can share that does what I need or
something similar?
Any help appreciated.
Thanks,
Matt
-=-
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users