call-effect ( quot effect -- ) (original) (raw)
Vocabulary
combinators
Inputs
quot | a quotation |
---|---|
effect | an effect |
Outputs
None
Word description
Given a quotation and a stack effect, calls the quotation, asserting at runtime that it has the given stack effect. This is a macro which expands given a literal effect parameter, and an arbitrary quotation which is not required at compile time.
Examples
The following two lines are equivalent:
call( a b -- c ) ( a b -- c ) call-effect
See also
call-effect-unsafe, execute-effect, execute-effect-unsafe
Definition
USING: accessors kernel kernel.private sequences ;
: call-effect ( quot effect -- )
2dup [
[ [ get-datastack ] dip dip ] dip dup terminated?>>
[ 2drop f ]
[ dup in>> length swap out>> length check-datastack ] if
] 2dip rot [ 2drop ] [ wrong-values ] if ;