[squeak-dev] Implementing a "prototype" in Squeak

Ralph Johnson johnson at cs.uiuc.edu
Sat Apr 24 15:47:49 UTC 2010


"Behavior" is what the VM knows about classes.  You shouldn't add instance
variables to Behavior, but you can add them to Class or Metaclass, which are
derived from it.

The trick of making an instance of Behavior that is a subclass of your
class, and then making that instance your class, is often called
"Lightweight classes".  I think it is just as good as giving your object a
method dictionary.  It is amusing to make an object be its own class, but I
don't see the advantage.  Most of the time you do not want your inspector to
show the method dictionary.

-Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100424/b153a6a8/attachment.htm


More information about the Squeak-dev mailing list