[Top][All Lists]

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

Re: [Chicken-users] catching errors at macro expansion time

From: felix winkelmann
Subject: Re: [Chicken-users] catching errors at macro expansion time
Date: Mon, 13 Jun 2005 21:46:56 +0200

On 6/13/05, Michele Simionato <address@hidden> wrote:
> It looks like "handle-exception" cannot handles exceptions happening at macro
> expansion time:
> (define-macro (raise-error bool)
>   (if (eq? #t bool)
>       (error "error inside macro!"))
>   #f)
> (handle-exceptions exn (print "error caught")
>                    (raise-error #t))
> The error is NOT caught. Is this the right behavior?

Yes, it's absolutely correct: the handle-exceptions clause
above is executed at *runtime*, the macro-expansion happens
at compile/macroexpansion-time.
To catch macroexpansion errors, try this:

(handle-exceptions ex ... (macroexpand '(raise-error #f)))

(in the interpreter)


reply via email to

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