with-disposal ( object quot -- )
Factor handbook » The language » Deterministic resource disposal » Using destructors

Prev:dispose ( disposable -- )
Next:dispose-each ( seq -- )


Vocabulary
destructors

Inputs
objecta disposable object
quota quotation with stack effect ( object -- )


Outputs
None

Word description
Calls the quotation, disposing the object with dispose after the quotation returns or if it throws an error.

Notes
Jumping out of the quotation with continue or continue-with bypasses disposal. See Resource disposal and continuations.

Definition