metawhat?
by bdimcheff
- 1,348 views
A look into Ruby's object model, metaclasses, and method dispatch.
A look into Ruby's object model, metaclasses, and method dispatch.
Statistics
- Likes
- 2
- Downloads
- 12
- Comments
- 0
- Embed Views
- Views on SlideShare
- 1,346
- Total Views
- 1,348

how many have written this?
not for class methods?
cout?
we want class methods
no methods
no methods
by process of elimination, methods are stored on the class
eventually call method_missing
eventually call method_missing
eventually call method_missing
eventually call method_missing
slight differences in meaning sometimes
singleton class stores instance-specific behavior
created automatically on request (class << obj)
classes are objects
metaclasses store instance specific behavior for classes
groovy has explicit access to singleton
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
dereference class pointer, look up method, climb inheritance chain
class of Primate is class b/c we did Class.new
that includes object
insert object into graph
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
object’s class methods will not be visible on primate
Primate.inspect
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
Primate.foo inherits from Object
the metaclass of my superclass is the superclass of my metaclass
look at the diagram, what is Joe’s singleton’s superclass?
including a module inserts it into the inheritance chain
ruby 1.8 only
switches into the context of the singleton class of self