Instance-specific behavior question (like Ruby?)

Avi Bryant avi at beta4.com
Tue Mar 23 09:07:17 UTC 2004


On Mar 23, 2004, at 12:00 AM, Poster at Kinetium dot Com wrote:

> I am somewhat familiar with the idiom of doing instance specialization 
> by
> overriding "doesNotUnderstand".
>
> Ruby provides a different and more direct way of doing such prototype 
> based
> programming: it simply makes the instance belong to a new (anonymous) 
> class,
> and puts any instance-specific behavior on that class. It provides a 
> syntax
> to define that behavior (since the class is anonymous).
>
> Is there a way to do this in Squeak? I'm a relative Squeak newbie ...

Sure.  See my Singletons package on SqueakMap, which implements 
singleton methods exactly the same way Ruby does.




More information about the Squeak-dev mailing list