6.25.5.1 Basic mini-oof.fs Usage

There is a base class (class, which allocates one cell for the object pointer) plus seven other words: to define a method, a variable, a class; to end a class, to resolve binding, to allocate an object and to compile a class method.

object ( – a-addr  ) mini-oof “object”

object is the base class of all objects.

method ( m v "name" – m’ v  ) mini-oof2 “method”

Define a selector name; increments the number of selectors m (in bytes).

var ( m v size "name" – m v’  ) mini-oof2 “var”

define an instance variable with size bytes by the name name, and increments the amount of storage per instance m by size.

class ( class – class methods vars  ) mini-oof2 “class”

start a class definition with superclass class, putting the size of the methods table and instance variable space on the stack.

end-class ( class methods vars "name" –  ) mini-oof2 “end-class”

finishs a class definition and assigns a name name to the newly created class. Inherited methods are copied from the superclass.

defines ( xt class "name" –  ) mini-oof “defines”

Bind xt to the selector name in class class.

new ( class – o  ) mini-oof “new”

Create a new incarnation of the class class.

:: ( class "name" –  ) mini-oof “colon-colon”

Compile the method for the selector name of the class class (not immediate!).