
At this stage, the 'self hole' is waiting for an object to be supplied. Any object that conforms to the required interface can be supplied. Recursion occurs because the object that is used to fill the hole is the object itself...
...this is achieved by grabbing the top of the object, pulling it round and feeding the object into its own 'self hole'...
grab the top ...


...feed the object in and keep going...

This trick can be be used to explain super too. Instead of onw hole there are two holes:
Inheritance means fitting rods together:
This idea was used to define a semantics for Smalltalk. The details can be found here but beware, it is a scanned document and is over 60MB. This slightly less esoteric (but a similarly large scanned document) set of notes on OOP and recursion is a useful introduction.
No comments:
Post a Comment