From 84b5ace86378d51ea4d6c9ad40aeaff1b8a0e0b5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 28 Mar 2009 22:26:49 -0500 Subject: [PATCH] alien.destructors: ignore any output values from disposal word --- basis/alien/destructors/destructors.factor | 5 +++-- basis/combinators/smart/smart.factor | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/basis/alien/destructors/destructors.factor b/basis/alien/destructors/destructors.factor index 1b6022d3b7..1c5c975fe6 100644 --- a/basis/alien/destructors/destructors.factor +++ b/basis/alien/destructors/destructors.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: functors destructors accessors kernel parser words ; +USING: functors destructors accessors kernel parser words +combinators.smart ; IN: alien.destructors SLOT: alien @@ -18,7 +19,7 @@ TUPLE: F-destructor alien disposed ; : ( alien -- destructor ) f F-destructor boa ; inline -M: F-destructor dispose* alien>> F ; +M: F-destructor dispose* [ alien>> F ] drop-outputs ; : &F ( alien -- alien ) dup &dispose drop ; inline diff --git a/basis/combinators/smart/smart.factor b/basis/combinators/smart/smart.factor index e7bdd75ced..aa7960539c 100644 --- a/basis/combinators/smart/smart.factor +++ b/basis/combinators/smart/smart.factor @@ -4,6 +4,9 @@ USING: accessors fry generalizations kernel macros math.order stack-checker math ; IN: combinators.smart +MACRO: drop-outputs ( quot -- quot' ) + dup infer out>> '[ @ _ ndrop ] ; + MACRO: output>sequence ( quot exemplar -- newquot ) [ dup infer out>> ] dip '[ @ _ _ nsequence ] ;