[Scheme-reports] Fwd: Comments on draft 6 about call/cc Alex Shinn (20 Feb 2012 07:37 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Alaric Snell-Pym (20 Feb 2012 10:32 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Jussi Piitulainen (20 Feb 2012 11:15 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Andy Wingo (21 Feb 2012 09:49 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Jussi Piitulainen (22 Feb 2012 11:10 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Alaric Snell-Pym (20 Feb 2012 12:49 UTC)
Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Perry E. Metzger (20 Feb 2012 18:57 UTC)

Re: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Andy Wingo 21 Feb 2012 09:48 UTC

On Tue 21 Feb 2012 02:15, John Cowan <cowan@mercury.ccil.org> writes:

> An exceptional exit is simply a non-local exit from an exception handler.
> It's not particularly obvious when this is happening.

What's wrong with something like this?

  (define (call-with-input-file filename proc)
    (let ((port (open-input-file filename)))
      (with-exception-handler
        (lambda (x)
          (close-input-port port)
          x)
        (lambda ()
          (call-with-values (lambda () (proc port))
            (lambda vals
              (close-input-port port)
              (apply values vals)))))))

> `Guard` works by capturing its continuation and setting a handler that
> captures the continuation at the point of raise.  The guard continuation
> is then restored, which gives us the outer dynamic environment, and the
> cond-clauses are executed.  If we fall off the end of the cond-clauses,
> the point-of-raise continuation is restored (giving us the inner dynamic
> environment) and the condition object is reraised.

This is expensive (reifying continuations for exceptional control-flow)
and error-prone (giving dynamic-wind workouts, and preventing exception
handling within run-once blocks).

Andy
--
http://wingolog.org/

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