overridding without subclassing examples
david.mitchell at gmail.com
Wed Sep 19 01:50:04 UTC 2007
Nope. Not about the GoF Singleton pattern at all.
More like Ruby singleton methods. Which is about an instance or
instances that have methods that aren't defined in the class for all
"This package adds the #becomeSingleton method to Object, which will
transform the receiver into an instance of a new, anonymous subclass
of its original class. This lets you add or redefine methods on an
On 9/18/07, Brad Fuller <bradallenfuller at yahoo.com> wrote:
> On Tue September 18 2007, Chris Muller wrote:
> > Avi's "Singletons" package might be what you're looking for..
> Hmm... Is that anything like the Singleton pattern of having only one instance
> of a class? That's not what I'm looking for. I want many instances.
> > On 9/18/07, Brad Fuller <bradallenfuller at yahoo.com> wrote:
> > > Is there a way to override an instance method w/o subclassing?
> > > For instance, class Morph has a method that returns true, but I want the
> > > that
> > > method to return false when instancing some types of Morphs and others
> > > not. (there is no setter/getter for this method.) Is there a way to do
> > > that w/o adding a setter/getter to Morph or subclassing the different
> > > Morphs?
More information about the Squeak-dev