Paul Wallich
6/12/2016 2:37:00 PM
On 6/12/16 8:40 AM, Malice wrote:
> On Sunday, 12 June 2016 02:15:35 UTC+2, Paul Rubin wrote:
>> The Lisp equivalent to that is called unwind-protect.
>
>
> I am aware of unwind-protect. The thing is, you need to call it explicitly, or make a macro that will use it - otherwise you still lose. In C++, if you use RAII, then destructor takes care of memory and there's no way to prevent that from happening.
It sounds as if you have the same issues, just in different places. In
C++, a programmer could build their own infrastructure that didn't
employ RAII, and they would face the same issues as a Lisp programmer
who didn't use a with- form or an explicit unwind-protect. (If you
really wanted belt and suspenders, you could build a framework that
checked for unprotected use of the things would wanted to be accessed
only within a with- or unwind-protect, but since at that point you're
trying to protect against deliberate stupidity it's unlikely to be
completely successful.)
paul