Inheritance and Lookup

5: Lookup in metaclasses

Damien Cassou, Stéphane Ducasse and Luc Fabresse http://stephane.ducasse.free.fr

Goal

  1. in Pharo, everything is an object
  2. objects can receive messages
  3. classes are objects too

Classes can receive messages. The mechanism is exactly the same

Only One Lookup Rule

The lookup starts in the class of the receiver then:

  • if the method is defined in the class, it is returned
  • otherwise the search continues in the superclass

A Class is an Instance of Another Class

Class X is always the unique instance of the class X class:

Superclass Chain

Lookup of Class Methods is No Different

What You Should Know

/