On Saturday, 14 February 2026 at 18:42:21 UTC, H. S. Teoh wrote:
As we can explicitly call destroy() on a class instance
multiple times, do we need to be "careful" of only closing a
file once, rather than closing a file multiple times, if that
can cause issues.
Calling .destroy on a class object more than once may trigger
UB.
This is technically true, in the sense that calling any function
could conceivably trigger UB, but destructors *should* be
idempotent, and any destructor marked as @safe *must* be
idempotent.