]> gitweb.factorcode.org Git - factor.git/blobdiff - core/destructors/destructors.factor
core: trim using lists with lint.vocabs tool
[factor.git] / core / destructors / destructors.factor
old mode 100755 (executable)
new mode 100644 (file)
index 2196d4f..1ed1ce8
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007, 2010 Doug Coleman, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs continuations init kernel namespaces
+USING: accessors assocs continuations kernel namespaces
 sequences sets ;
 IN: destructors
 
@@ -19,7 +19,7 @@ SLOT: continuation
     disposables get adjoin ;
 
 : unregister-disposable ( obj -- )
-    disposables get 2dup in? [ delete ] [ drop already-unregistered ] if ;
+    dup disposables get ?delete [ drop ] [ already-unregistered ] if ;
 
 PRIVATE>
 
@@ -59,7 +59,7 @@ M: disposable dispose
     [ last rethrow ] unless-empty ;
 
 : with-disposal ( object quot -- )
-    over [ dispose ] curry [ ] cleanup ; inline
+    over [ dispose ] curry finally ; inline
 
 <PRIVATE
 
@@ -90,13 +90,13 @@ PRIVATE>
         cleanup
     ] with-variables ; inline
 
-[
+STARTUP-HOOK: [
     HS{ } clone disposables set-global
     V{ } clone always-destructors set-global
     V{ } clone error-destructors set-global
-] "destructors" add-startup-hook
+]
 
-[
+SHUTDOWN-HOOK: [
     do-always-destructors
     do-error-destructors
-] "destructors" add-shutdown-hook
+]