Re: Unwind-protect Lassi Kortela 09 Oct 2022 15:41 UTC

>>> That's a good point. (I missed initially that there can be more than
>>> one cleanup form.) Does CL execute the cleanup forms in order of their
>>> appearance?
>>
>> Yes.  It's the same as (unwind-protect protected-form (begin cleanup-form ...))

That's how I interpret CLHS, too:

"If a non-local exit occurs during execution of cleanup-forms, no
special action is taken. The cleanup-forms of unwind-protect are not
protected by that unwind-protect."

So if one cleanup-form raises an exception, any remaining cleanup-forms
are not evaluated.

> Thanks; with my definition, I would have to code it like
> (unwind-protect protected-form (begin (values) cleanup-form ...)) as
> otherwise definitions would be allowed by the definition making it too
> easy to write non-portable code.

Is there any prior art in Scheme for an implicit (begin ...) that does
not admit definitions?