GENERIC#:
Factor handbook > The language > Objects > Generic words and methods

Prev:GENERIC:
Next:HOOK:


Vocabulary
syntax

Syntax
GENERIC#: word n ( stack -- effect )


Inputs and outputs
worda new word to define
nthe stack position to dispatch on


Word description
Defines a new generic word in the current vocabulary. The word dispatches on the nth element from the top of the stack. Initially it contains no methods, and thus will throw a no-method error when called.

Notes
The following two definitions are equivalent:
GENERIC: foo ( x y z obj -- )

GENERIC#: foo 0 ( x y z obj -- )


See also
generic, define-generic, define-simple-generic, GENERIC:, MATH:, HOOK:

Definition