output-mismatch-error ( value expected-type word expected-types -- * ) (original) (raw)

output-mismatch-error ( value expected-type word expected-types -- * )
Strongly-typed word definitions

Prev: input-mismatch-error ( value expected-type word expected-types -- * )

Vocabulary
typed

Inputs

word a word
expected-types an array

Outputs
None

Class description
Errors of this class are raised at runtime by TYPED: words when they attempt to output values that do not match their type annotations. The word slot indicates the word that failed, and the expected-types slot specifies the output types expected.

Definition

IN: typed

ERROR: output-mismatch-error < type-mismatch-error ;

Methods

USING: accessors classes kernel make summary typed ;

M: output-mismatch-error summary
[
"Typed word '" % dup word>> name>> %
"' expected to output value of type " %
dup expected-type>> name>> % " but gave " %
dup value>> class-of name>> % drop
] "" make ;