chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] How to turn off exception handlers in my code?


From: Matt Welland
Subject: Re: [Chicken-users] How to turn off exception handlers in my code?
Date: Wed, 15 Mar 2017 13:53:53 -0700

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 <address@hidden> 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
-=-

reply via email to

[Prev in Thread] Current Thread [Next in Thread]