]> gitweb.factorcode.org Git - factor.git/commitdiff
destructors: adding dispose,.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 6 Mar 2013 17:16:43 +0000 (09:16 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 6 Mar 2013 17:16:43 +0000 (09:16 -0800)
core/destructors/destructors.factor

index 697bc2eeefa04feace8d4f47358390804cbabc45..0cb15ad40ac3d529ba5d00977e99d63855ce8a85 100755 (executable)
@@ -52,10 +52,12 @@ M: disposable dispose
         bi
     ] unless-disposed ;
 
+: dispose, ( obj -- )
+    [ dispose ] curry [ , ] recover ; inline
+
 : dispose-each ( seq -- )
-    [
-        [ [ dispose ] curry [ , ] recover ] each
-    ] { } make [ last rethrow ] unless-empty ;
+    [ [ dispose, ] each ] { } make
+    [ last rethrow ] unless-empty ;
 
 : with-disposal ( object quot -- )
     over [ dispose ] curry [ ] cleanup ; inline