]> gitweb.factorcode.org Git - factor.git/commitdiff
kernel: add full stack effects to unless, when, when*, unless* so they give useful...
authorJoe Groff <arcata@gmail.com>
Tue, 9 Aug 2011 17:32:12 +0000 (10:32 -0700)
committerJoe Groff <arcata@gmail.com>
Tue, 9 Aug 2011 17:32:12 +0000 (10:32 -0700)
core/kernel/kernel.factor

index e506b7fc27b9f9fed26ce0fc18e3e24f987dcebc..7cf700535034276bc1b83b47804e4a6a866fd728 100644 (file)
@@ -32,20 +32,20 @@ DEFER: if
 : if ( ..a ? true: ( ..a -- ..b ) false: ( ..a -- ..b ) -- ..b ) ? call ;
 
 ! Single branch
-: unless ( ? false -- )
+: unless ( ..a ? false: ( ..a -- ..a ) -- ..a )
     swap [ drop ] [ call ] if ; inline
 
-: when ( ? true -- )
+: when ( ..a ? true: ( ..a -- ..a ) -- ..a )
     swap [ call ] [ drop ] if ; inline
 
 ! Anaphoric
 : if* ( ..a ? true: ( ..a ? -- ..b ) false: ( ..a -- ..b ) -- ..b )
     pick [ drop call ] [ 2nip call ] if ; inline
 
-: when* ( ? true -- )
+: when* ( ..a ? true: ( ..a ? -- ..a ) -- ..a )
     over [ call ] [ 2drop ] if ; inline
 
-: unless* ( ? false -- )
+: unless* ( ..a ? false: ( ..a -- ..a x ) -- ..a x )
     over [ drop ] [ nip call ] if ; inline
 
 ! Default