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

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

Prev: define-typed ( word def effect -- )
Next: output-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 are invoked with input values that do not match their type annotations. The word slot indicates the word that failed, and the expected-types slot specifies the input types expected.

Definition

IN: typed

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

Methods

USING: accessors classes kernel make prettyprint summary typed ;

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