factor/core/effects.facts

25 lines
1.4 KiB
Plaintext
Raw Normal View History

2006-08-15 21:23:05 -04:00
IN: words
2006-09-06 18:06:11 -04:00
USING: help ;
2006-08-15 21:23:05 -04:00
HELP: effect
{ $class-description "An object representing a stack effect. Holds a sequence of inputs, a sequence of outputs and a flag indicating if an error is thrown unconditionally." } ;
HELP: effect-height
{ $values { "effect" "a stack effect" } { "n" "an integer" } }
{ $description "Outputs the number of items added to the data stack by the stack effect. This will be negative if the stack effect only removes objects from the stack." } ;
HELP: effect<=
{ $values { "eff1" "a stack effect" } { "eff2" "a stack effect" } { "?" "a boolean" } }
{ $description "Tests if " { $snippet "eff1" } " can be used anywhere " { $snippet "eff2" } " can. What this means is that both stack effects change the stack height by the same amount, the first takes a smaller or equal number of inputs as the second, and either both or neither one terminate execution by throwing an error." } ;
HELP: effect>string
{ $values { "effect" "a stack effect" } { "string" "a string" } }
{ $description "Turns a stack effect object into a string mnemonic." }
{ $examples
2006-12-13 04:01:42 -05:00
{ $example "1 2 <effect> effect>string print" "( object -- object object )" }
2006-08-15 21:23:05 -04:00
} ;
HELP: stack-effect
{ $values { "word" "a word" } { "effect/f" "a stack effect" } }
2006-09-06 18:06:11 -04:00
{ $description "Outputs the stack effect of a word; either a stack effect declared with " { $link POSTPONE: ( } ", or an inferred stack effect (see " { $link "inference" } "." } ;