IN: temporary
USING: alien compiler errors inference io kernel
-kernel-internals math memory namespaces test threads ;
+kernel-internals math memory namespaces test threads words ;
: callback-1 "void" { } [ ] alien-callback ;
-[ { 0 1 } ] [ [ callback-1 ] infer ] unit-test
+[ 0 1 ] [ [ callback-1 ] infer nip dup effect-in swap effect-out ] unit-test
[ t ] [ callback-1 alien? ] unit-test
USING: compiler definitions generic hashtables inference math
-namespaces parser test words ;
+namespaces parser test words kernel sequences arrays ;
IN: temporary
DEFER: foo \ foo reset-generic
DEFER: bar \ bar reset-generic
+: short-effect
+ dup effect-in length swap effect-out length 2array nip ;
+
[ ] [ \ foo [ 1 2 ] define-compound ] unit-test
-[ { 0 2 } ] [ [ foo ] infer ] unit-test
+[ { 0 2 } ] [ [ foo ] infer short-effect ] unit-test
[ ] [ \ foo compile ] unit-test
[ ] [ \ bar [ foo foo ] define-compound ] unit-test
[ ] [ \ bar compile ] unit-test
[ ] [ \ foo [ 1 2 3 ] define-compound ] unit-test
[ t ] [ \ bar changed-words get hash-member? ] unit-test
[ ] [ recompile ] unit-test
-[ { 0 3 } ] [ [ foo ] infer ] unit-test
+[ { 0 3 } ] [ [ foo ] infer short-effect ] unit-test
[ f ] [ \ bar changed-words get hash-member? ] unit-test
[ ] [ \ bar [ 1 2 ] define-compound ] unit-test
[ t ] [ \ bar changed-words get hash-member? ] unit-test
[ ] [ recompile ] unit-test
-[ { 0 2 } ] [ [ bar ] infer ] unit-test
+[ { 0 2 } ] [ [ bar ] infer short-effect ] unit-test
[ f ] [ \ bar changed-words get hash-member? ] unit-test
[ ] [ \ foo [ 1 2 3 ] define-compound ] unit-test
[ f ] [ \ bar changed-words get hash-member? ] unit-test
{ +quot+ [ forget ] }
} define-operation
+[ word? ] H{
+ { +name+ "Word stack effect" }
+ { +keyboard+ T{ key-down f { A+ } "i" } }
+ { +quot+ [ word-def infer. ] }
+ { +listener+ t }
+} define-operation
+
[ word? ] H{
{ +name+ "Word dataflow" }
{ +keyboard+ T{ key-down f { A+ } "d" } }
! Quotations
[ quotation? ] H{
- { +name+ "Infer" }
+ { +name+ "Quotation stack effect" }
{ +keyboard+ T{ key-down f { C+ A+ } "i" } }
- { +quot+ [ infer . ] }
+ { +quot+ [ infer. ] }
{ +listener+ t }
} define-operation