[gambit-list] with-exception-handler versus with-exception-catcher -- bug?

Jason Felice jason.m.felice at gmail.com
Sun Feb 3 16:06:02 EST 2013


Yes, I'd missed that distinction.


On Sun, Feb 3, 2013 at 12:55 PM, Marc Feeley <feeley at iro.umontreal.ca>wrote:

>
> On 2013-02-03, at 6:40 AM, Jason Felice <jason.m.felice at gmail.com> wrote:
>
> > I think I'm seeing a gambit bug.
> >
> > I have a situation where this returns #f:
> >
> > (with-exception-handler
> >   (lambda (e) #t)
> >   (lambda () (trampoline-gp-set! (make-trampoline) 6 99) #f))
> >
> > And this returns #t:
> >
> > (with-exception-catcher
> >   (lambda (e) #t)
> >   (lambda () (trampoline-gp-set! (make-trampoline) 6 99) #f))
> >
> > And running this from the repl raises:
> >
> > (trampoline-gp-set! (make-trampoline) 6 99)
> >
> > The definition of trampoline-gp-set! is currently:
> >
> > (define trampoline-gp-set!/internal
> >   (c-lambda (trampoline int unsigned-int64)
> >           void
> >     "___arg1->gp[___arg2] = ___arg3;"))
> >
> > (define (trampoline-gp-set! trampoline index value)
> >   (if (>= index 6)
> >     (raise "invalid index for trampoline-gp-set!"))
> >   (trampoline-gp-set!/internal trampoline index value))
> >
> > But all this happens with this definition as well:
> >
> > (define trampoline-gp-set!
> >   (c-lambda (trampoline int unsigned-int64)
> >           void
> > #<<END_OF_C_LAMBDA
> >   if (___arg2 >= 6)
> >     ___err = ___FIX(___UNKNOWN_ERR);
> >   else
> >     ___arg1->gp[___arg2] = ___arg3;
> > END_OF_C_LAMBDA
> > ))
> >
> > Am I missing something?
> >
> > I'm using WITH-EXCEPTION-HANDLER elsewhere to do the same thing and it
> appears to be working there.
>
> Are you aware that with-exception-catcher unwinds the stack (similarly to
> a try/catch in other languages), but with-exception-handler does not (the
> result of the exception handler will be returned by the call to raise).
>
> Does that help explain the behavior you are seeing?
>
> Marc Feeley
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130203/96251d86/attachment.htm>


More information about the Gambit-list mailing list