Sunday, June 22, 2008

smalltalk

wow, that's one cool explanation on class methods :)

When you create a class, Smalltalk creates a metaclass; and just like a class describes how methods for its instances work, a metaclass describes how class methods for that same class work.

Set is an instance of the metaclass, so when you invoke the #new class method, you can also say you are invoking an instance method implemented by Set class. Simply put, class methods are a lie: they're simply [metaclass] instance methods that are understood by instances of metaclasses.

No comments: