|
|
|
|
|
by gumby
884 days ago
|
|
Well lisps don’t really have destructors in the sense C++ does; objects go out of scope and become unreachable. So unwind-protect makes cleanup (closing a file, for example) explicit, which it has to be. I wouldn’t say RAII is “tied to object lifetime” except in its name; at least I think of it as every {} pair defining an unwind-protect with object creation/destruction being how it is effected by the programmer. Perhaps that is the same thing as you said, simply viewed from opposite sides. I do like the automatic nature of RAII, though implementing a whole class for it always feels clumsy to me even after doing it for decades. |
|