Previous: Objects Implementation, Up: Objects [Contents][Index]
bind
( ... "class" "selector" – ... ) objects
Execute the method for selector in class.
<bind>
( class selector-xt – xt ) objects “less-bind-to”
xt is the method for the selector selector-xt in class.
bind'
( "class" "selector" – xt ) objects “bind-tick”
xt is the method for selector in class.
[bind]
( compile-time: "class" "selector" – ; run-time: ... object – ... ) objects “left-bracket-bind-right-bracket”
Compile the method for selector in class.
class
( parent-class – align offset ) objects
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–to-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
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-store”
xt is the new method for the selector sel-xt in class-map.
class-previous
( class – ) objects
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-to-order”
Add class’s wordlists to the head of the search-order.
construct
( ... object – ) objects
Initialize the data fields of object. The method for the
class object just does nothing: ( object -- )
.
current'
( "selector" – xt ) objects “current-tick”
xt is the method for selector in the current class.
[current]
( compile-time: "selector" – ; run-time: ... object – ... ) objects “left-bracket-current-right-bracket”
Compile the method for selector in the current class.
current-interface
( – addr ) objects
Variable: contains the class or interface currently being defined.
dict-new
( ... class – object ) objects
allot
and initialize an object of class class in
the dictionary.
end-class
( align offset "name" – ) objects
name execution: -- class
End a class definition. The resulting class is class.
end-class-noname
( align offset – class ) objects
End a class definition. The resulting class is class.
end-interface
( "name" – ) objects
name
execution: -- interface
End an interface definition. The resulting interface is
interface.
end-interface-noname
( – interface ) objects
End an interface definition. The resulting interface is interface.
end-methods
( – ) objects
Switch back from defining methods of a class to normal mode (currently this just restores the old search order).
exitm
( – ) objects
exit
from a method; restore old this
.
heap-new
( ... class – object ) objects
allocate
and initialize an object of class class.
implementation
( interface – ) objects
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
Initialize a chunk of memory (object) to an object of
class class; then performs construct
.
inst-value
( align1 offset1 "name" – align2 offset2 ) objects
name execution: -- w
w is the value of the field name in this
object.
inst-var
( align1 offset1 align size "name" – align2 offset2 ) objects
name execution: -- addr
addr is the address of the field name in
this
object.
interface
( – ) objects
Start an interface definition.
m:
( – xt colon-sys; run-time: object – ) objects “m-colon”
Start a method definition; object becomes new this
.
:m
( "name" – xt; run-time: object – ) objects “colon-m”
Start a named method definition; object becomes new
this
. Has to be ended with ;m
.
;m
( colon-sys –; run-time: – ) objects “semicolon-m”
End a method definition; restore old this
.
method
( xt "name" – ) objects
name
execution: ... object -- ...
Create selector name and makes xt its method in
the current class.
methods
( class – ) objects
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
the ancestor of all classes.
overrides
( xt "selector" – ) objects
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 “left-bracket-parent-right-bracket”
Compile the method for selector in the parent of the current class.
print
( object – ) objects
Print the object. The method for the class object prints the address of the object and the address of its class.
protected
( – ) objects
Set the compilation wordlist to the current class’s wordlist
public
( – ) objects
Restore the compilation wordlist that was in effect before the
last protected
that actually changed the compilation
wordlist.
selector
( "name" – ) objects
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
the receiving object of the current method (aka active object).
<to-inst>
( w xt – ) objects “less-to-inst-to”
store w into the field xt in this
object.
[to-inst]
( compile-time: "name" – ; run-time: w – ) objects “left-bracket-to-inst-right-bracket”
store w into field name in this
object.
to-this
( object – ) objects
Set this
(used internally, but useful when debugging).
xt-new
( ... class xt – object ) objects
Make a new object, using xt ( align size -- addr )
to
get memory.
Previous: Objects Implementation, Up: Objects [Contents][Index]