Next: Comparison with other object models, Previous: The mini-oof.fs model, Up: Object-oriented Forth [Contents][Index]
Mini-OOF2 is very similar to Mini-OOF in many respects, but differs
significantly in a few aspects. In particular, Mini-OOF2 has a current
object variable, and uses the primitives >o
and o>
to
manipulate that object stack. All method invocations and instance
variable accesses refer to the current object.
>o
( c-addr – r:c-old ) new “to-o”
Set the current object to c_addr, the previous current object is pushed to the return stack
o>
( r:c-addr – ) new “o-restore”
Restore the previous current object from the return stack
To ease passing an object pointer to method invocation or instance
variable accesses, the additional recognizer rec-moof2
is
activated.
rec-moof2
( addr u – xt translate-moof2 | notfound ) mini-oof2 “rec-moof2”
Very simplistic dot-parser, transforms .
selector/ivar to
>o
selector/ivar o>
.