Handbook
Glossary
with-disposal ( object quot -- )
Factor handbook
»
The language
»
Deterministic resource disposal
»
Using destructors
Prev:
dispose ( disposable -- )
Next:
dispose-each ( seq -- )
Vocabulary
destructors
Inputs
object
a disposable object
quot
a
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
USING:
continuations
kernel
;
IN:
destructors
:
with-disposal
( object quot -- )
over
[
dispose
]
curry
finally
;
inline