destructors: adding dispose,.
parent
a60b49630f
commit
87d65d66d6
|
@ -52,10 +52,12 @@ M: disposable dispose
|
||||||
bi
|
bi
|
||||||
] unless-disposed ;
|
] unless-disposed ;
|
||||||
|
|
||||||
|
: dispose, ( obj -- )
|
||||||
|
[ dispose ] curry [ , ] recover ; inline
|
||||||
|
|
||||||
: dispose-each ( seq -- )
|
: dispose-each ( seq -- )
|
||||||
[
|
[ [ dispose, ] each ] { } make
|
||||||
[ [ dispose ] curry [ , ] recover ] each
|
[ last rethrow ] unless-empty ;
|
||||||
] { } make [ last rethrow ] unless-empty ;
|
|
||||||
|
|
||||||
: with-disposal ( object quot -- )
|
: with-disposal ( object quot -- )
|
||||||
over [ dispose ] curry [ ] cleanup ; inline
|
over [ dispose ] curry [ ] cleanup ; inline
|
||||||
|
|
Loading…
Reference in New Issue