Handbook
Glossary
create-method ( class generic -- method )
Factor handbook
»
The language
»
Objects
»
Generic words and methods
»
Generic word introspection
Prev:
define-simple-generic ( word effect -- )
Next:
lookup-method ( class generic -- method )
Vocabulary
generic
Inputs
class
a
class
generic
a
generic
Outputs
method
a
method
Word description
Creates a method or returns an existing one. This is the runtime equivalent of
M:
.
Notes
To define a method, pass the output value to
define
.
See also
lookup-method
,
?lookup-method
,
M:
Definition
USING:
classes.private
kernel
words
;
IN:
generic
:
create-method
( class generic -- method )
2dup
?lookup-method
dup
[
2nip
dup
reset-generic
]
[
drop
[
<method>
dup
]
2keep
reveal-method
reset-caches
]
if
;