declare ( spec -- )


Vocabulary
kernel.private

Inputs and outputs
specan array of class words


Word description
Declares that the elements at the top of the stack are instances of the classes in spec.

Warning
The compiler blindly trusts declarations, and false declarations can lead to crashes, memory corruption and other undesirable behavior.


Examples
The optimizer cannot do anything with the below code:
2 + 10 *

However, if we declare that the top of the stack is a float, then type checks and generic dispatch are eliminated, and the compiler can use unsafe intrinsics:
{ float } declare 2 + 10 *


Definition