Previous: Objects Implementation, Up: Objects
bind
... "class" "selector" – ... objects “bind”
Execute the method for selector in class.
<bind>
class selector-xt – xt objects “<bind>”
xt is the method for the selector selector-xt in class.
bind'
"class" "selector" – xt objects “bind”'
xt is the method for selector in class.
[bind]
compile-time: "class" "selector" – ; run-time: ... object – ... objects “[bind]”
Compile the method for selector in class.
class
parent-class – align offset objects “class”
Start a new class definition as a child of parent-class. align offset are for use by field etc.
class->map
class – map objects “class->map”
map is the pointer to class's method map; it points to the place in the map to which the selector offsets refer (i.e., where object-maps point to).
class-inst-size
class – addr objects “class-inst-size”
Give the size specification for an instance (i.e. an object)
of class;
used as class-inst-size 2 ( class -- align size )
.
class-override!
xt sel-xt class-map – objects “class-override!”
xt is the new method for the selector sel-xt in class-map.
class-previous
class – objects “class-previous”
Drop class's wordlists from the search order. No checking is made whether class's wordlists are actually on the search order.
class>order
class – objects “class>order”
Add class's wordlists to the head of the search-order.
construct
... object – objects “construct”
Initialize the data fields of object. The method for the
class object just does nothing: ( object -- )
.
current'
"selector" – xt objects “current”'
xt is the method for selector in the current class.
[current]
compile-time: "selector" – ; run-time: ... object – ... objects “[current]”
Compile the method for selector in the current class.
current-interface
– addr objects “current-interface”
Variable: contains the class or interface currently being defined.
dict-new
... class – object objects “dict-new”
allot
and initialize an object of class class in
the dictionary.
end-class
align offset "name" – objects “end-class”
name execution: -- class
End a class definition. The resulting class is class.
end-class-noname
align offset – class objects “end-class-noname”
End a class definition. The resulting class is class.
end-interface
"name" – objects “end-interface”
name
execution: -- interface
End an interface definition. The resulting interface is
interface.
end-interface-noname
– interface objects “end-interface-noname”
End an interface definition. The resulting interface is interface.
end-methods
– objects “end-methods”
Switch back from defining methods of a class to normal mode (currently this just restores the old search order).
exitm
– objects “exitm”
exit
from a method; restore old this
.
heap-new
... class – object objects “heap-new”
allocate
and initialize an object of class class.
implementation
interface – objects “implementation”
The current class implements interface. I.e., you can use all selectors of the interface in the current class and its descendents.
init-object
... class object – objects “init-object”
Initialize a chunk of memory (object) to an object of
class class; then performs construct
.
inst-value
align1 offset1 "name" – align2 offset2 objects “inst-value”
name execution: -- w
w is the value of the field name in this
object.
inst-var
align1 offset1 align size "name" – align2 offset2 objects “inst-var”
name execution: -- addr
addr is the address of the field name in
this
object.
interface
– objects “interface”
Start an interface definition.
m:
– xt colon-sys; run-time: object – objects “m:”
Start a method definition; object becomes new this
.
:m
"name" – xt; run-time: object – objects “:m”
Start a named method definition; object becomes new
this
. Has to be ended with ;m
.
;m
colon-sys –; run-time: – objects “;m”
End a method definition; restore old this
.
method
xt "name" – objects “method”
name
execution: ... object -- ...
Create selector name and makes xt its method in
the current class.
methods
class – objects “methods”
Makes class the current class. This is intended to be used for defining methods to override selectors; you cannot define new fields or selectors.
object
– class objects “object”
the ancestor of all classes.
overrides
xt "selector" – objects “overrides”
replace default method for selector in the current class
with xt. overrides
must not be used during an
interface definition.
[parent]
compile-time: "selector" – ; run-time: ... object – ... objects “[parent]”
Compile the method for selector in the parent of the current class.
print
object – objects “print”
Print the object. The method for the class object prints the address of the object and the address of its class.
protected
– objects “protected”
Set the compilation wordlist to the current class's wordlist
public
– objects “public”
Restore the compilation wordlist that was in effect before the
last protected
that actually changed the compilation
wordlist.
selector
"name" – objects “selector”
name execution: ... object -- ...
Create selector name for the current class and its
descendents; you can set a method for the selector in the
current class with overrides
.
this
– object objects “this”
the receiving object of the current method (aka active object).
<to-inst>
w xt – objects “<to-inst>”
store w into the field xt in this
object.
[to-inst]
compile-time: "name" – ; run-time: w – objects “[to-inst]”
store w into field name in this
object.
to-this
object – objects “to-this”
Set this
(used internally, but useful when debugging).
xt-new
... class xt – object objects “xt-new”
Make a new object, using xt ( align size -- addr )
to
get memory.