Stack effect checking escape hatches
Factor handbook » The language » Stack effect checking

Prev:Stack checker errors

In a static checking regime, sometimes it is necessary to step outside the boundaries and run some code which cannot be statically checked; perhaps this code is constructed at run-time. There are two ways to get around the static stack checker.

If the stack effect of a word or quotation is known, but the word or quotation itself is not, execute( or call( can be used. See Fundamental combinators for details.

If the stack effect is not known, the code being called cannot manipulate the datastack directly. Instead, it must reflect the datastack into an array:
with-datastack ( stack quot -- new-stack )

The surrounding code has a static stack effect since with-datastack has one. However, the array passed in as input may be transformed arbitrarily by calling this combinator.