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

Re: [Scheme-reports] confusing example in 6.11. Exceptions



On Wed, Dec 12, 2012 at 4:38 AM, Per Bothner <per@x> wrote:
I don't quite understand the second example under with-exception-handler:

(call-with-current-continuation
   (lambda (k)
     (with-exception-handler
       (lambda (x)
         (display "something went wrong")
         (newline)
         ’dont-care)
       (lambda ()
         (+ 1 (raise ’an-error))))))

First - does the call-with-current-continuation call
actually do anything?  I.e. how is this example different
from:

(with-exception-handler
   (lambda (x)
     (display "something went wrong")
     (newline)
     ’dont-care)
   (lambda ()
     (+ 1 (raise ’an-error))))

In this case, no, I think we should simplify this.
It was probably just left over from copying the
first example.
 
Second, raise states "If the handler returns, a secondary
exception is raised in the same dynamic environment as the handler."
That to me means the effect of the with-exception-handler
is to raise an exception handled by some top-level handler.
However, the example says the _expression_ evaluates to <unspecified>
- i.e. it should actually return.

Yes, that's what will happen - I'll fix that.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports