[Top][All Lists]

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

Re: [Chicken-hackers] catching compiling exceptions in setup-api

From: Jim Ursetto
Subject: Re: [Chicken-hackers] catching compiling exceptions in setup-api
Date: Tue, 10 Aug 2010 11:15:12 -0500

On Tue, Aug 10, 2010 at 02:15, Felix
<address@hidden> wrote:
> You can override the ##sys#reset-handler (for example using
> `parameterize'), which is just a thunk and by default invokes
> `exit'.

I thought you might say that.  Is it possible to document that this is
the official way to catch compilation errors?  Why does it call
(reset) instead of (error)?  (execute) calls its arguments in a
for-each loop, is it safe to escape out of this loop via call/cc from
the reset handler?  Do I need to worry about the stack?  Do I need to
worry the reset handler might be called due to a real exception?

This seems to work to convert the call to reset into an exception,
does it make sense?

 (let ((old-reset (##sys#reset-handler)))
   (parameterize ((##sys#reset-handler
                   (lambda ()
                     (parameterize ((##sys#reset-handler old-reset))
                       (error 'execute "compilation error")))))
     (compile file.scm)))

reply via email to

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