Handbook
Glossary
define-slot-methods ( class slot-spec -- )
Factor handbook
»
The language
»
Objects
»
Low-level slot operations
Prev:
define-changer ( name -- )
Next:
define-accessors ( class specs -- )
Vocabulary
slots
Inputs
class
a
class
slot-spec
a
slot-spec
Outputs
None
Word description
Defines a reader, writer, setter and changer for a slot specified by
slot-spec
.
Notes
Calling this word directly is not necessary in most cases. Higher-level words call it automatically.
Definition
USING:
accessors
kernel
;
IN:
slots
:
define-slot-methods
( class slot-spec -- )
[
define-reader
]
[
dup
read-only>>
[
2drop
]
[
[
name>>
define-setter
drop
]
[
name>>
define-changer
drop
]
[
define-writer
]
2tri
]
if
]
2bi
;