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 19:27 UTC

Am Fr., 28. Okt. 2022 um 21:14 Uhr schrieb Vincent Manis <xxxxxx@telus.net>:
>
> On 2022-10-28 11:58, Marc Nieper-Wißkirchen wrote:
>
> > IMO, it is actually a good thing for the name to be quite different
> > from Scheme's dynamic-wind.  Dynamic-wind is built so that control can
> > leave and enter the THUNK several times and has the notion of a
> > BEFORE-THUNK.  The first is forbidden and the latter is not the case
> > for unwind-protect.  Moreover, unwind-protect is syntax, while
> > dynamic-wind-once would probably be expected to be a procedure as
> > well.
> >
> > What do you think?
>
> Well, we have a procedure and a special form that do essentially similar
> things, namely ensuring that some cleanup code is executed when the
> protected form is exited, and yet one's name includes “wind” and the
> other's includes “unwind”. At the risk of saying something
> flammable/inflammable, this seems needlessly confusing. Perhaps
> `dynamic-wind' should have been called something else (though there were
> good reasons for choosing that name), but that ship has sailed.

The point of unwind-protect is that the cleanup code is run (once and
without an exception bar thread termination).  The point of
dynamic-wind is to extend the dynamic environment (meant in a
generalized sense) during the dynamic extent of the THUNK.

These are pretty different things conceptually.

I am not saying that dynamic-wind is necessarily a good name, but as
you say, we cannot change it anymore.  On the other hand, changing the
name unwind-protect won't help anyone who knows it from Common Lisp. A
third name implies that people may think there is a third concept
besides dynamic-wind and unwind-protect.

> Could this new form be called `wind-protect'?

I am not convinced; I fear that this will cause more confusion than it
tries to solve.  John initially proposed adding unwind-protect, maybe
he can chime in as well.

> I also think it's necessary to have an explanation about the differences
> between dynamic-wind and this new form. It's not obvious to me that a
> (human) reader would grasp the need for both without a few sentences
> explaining the intended uses.

I can add a sentence pointing out the use of unprotect-wind for
cleanup purposes.  I should also add a remark that the syntax has its
origins in CL, explaining the name.