[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: |
Felix |
Subject: |
Re: [Chicken-hackers] catching compiling exceptions in setup-api |
Date: |
Tue, 10 Aug 2010 22:24:06 +0200 (CEST) |
From: Jim Ursetto <address@hidden>
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?
It is not the official way, but documenting this might be a good idea.
> Why does it call
> (reset) instead of (error)?
I can't remember.
> (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?
I think it is. That's what continuations are there for, or not?
> Do I need to worry about the stack?
Which stack?
> Do I need to
> worry the reset handler might be called due to a real exception?
Yes, since you have overridden it.
>
> 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)))
>
Yes. `reset' is there to provide an alternative way of aborting and
throwing into the REPL, if one is active, without printing an
error message. I agree that its use probably doesn't make sense in
`setup-api' and will try to change that.
cheers,
felix