Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 09:56 UTC)
Re: Unwind-protect Shiro Kawai (09 Oct 2022 10:41 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 11:21 UTC)
Re: Unwind-protect Shiro Kawai (09 Oct 2022 12:46 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 13:07 UTC)
Re: Unwind-protect Shiro Kawai (09 Oct 2022 13:26 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 13:58 UTC)
Re: Unwind-protect Shiro Kawai (09 Oct 2022 22:50 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (10 Oct 2022 05:57 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (10 Oct 2022 07:24 UTC)
Re: Unwind-protect Shiro Kawai (10 Oct 2022 07:25 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (10 Oct 2022 07:39 UTC)
Re: Unwind-protect Shiro Kawai (10 Oct 2022 08:57 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (10 Oct 2022 08:59 UTC)
Re: Unwind-protect John Cowan (09 Oct 2022 15:03 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 15:13 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 15:39 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 16:13 UTC)
Re: Unwind-protect Lassi Kortela (09 Oct 2022 15:41 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (09 Oct 2022 16:11 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (28 Oct 2022 11:08 UTC)
Re: Unwind-protect Vincent Manis (28 Oct 2022 18:53 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (28 Oct 2022 18:58 UTC)
Re: Unwind-protect Vincent Manis (28 Oct 2022 19:14 UTC)
Re: Unwind-protect Marc Nieper-Wißkirchen (28 Oct 2022 19:28 UTC)
Re: Unwind-protect Arthur A. Gleckler (28 Oct 2022 19:31 UTC)

Re: Unwind-protect Marc Nieper-Wißkirchen 28 Oct 2022 11:08 UTC

Am So., 9. Okt. 2022 um 11:55 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@gmail.com>:
>
> John Cowan suggested that SRFI 226 should include a version of Common
> Lisp's unwind-protect suitable for Scheme.
>
> In [1], I replied after some discussion with the following proposal
> for a definition of a Scheme unwind-protect:
>
> (define-syntax unwind-protect
>   (syntax-rules ()
>     ((unwind-protect protected-form cleanup-form)
>      (call-with-continuation-barrier
>        (lambda ()
>          (dynamic-wind
>            (lambda () (values))
>            (lambda () protected-form)
>            (lambda () cleanup-form)))))))

I am currently adding unwind-protect to the spec.  The actual
definition should be

(define-syntax unwind-protect
  (syntax-rules ()
    ((unwind-protect protected-form cleanup-form ...)
     (lambda ()
       (dynamic-wind
         (lambda () (values))
         (lambda () (call-with-continuation-barrier (lambda ()
protected-form))))
         (lambda () (values) cleanup-form ...))))))

because there is no reason to protect the cleanup-forms from
call/cc-havoc.  The reason is that these forms are not protected
otherwise as well.

Marc