overridding without subclassing examples

Travis Kay tlk at nb.sympatico.ca
Wed Sep 19 21:07:12 UTC 2007


UniClasses and Players are named+number subclasses that get put into the 
UserObjects category. Avis' Singletons package works differently.

Travis
 
David Mitchell wrote:
> Apparently terminology.
>
> Also, it appears that Avi's Singleton's package isn't available
> anymore (the link on Squeak Map points to the beta4.com site that has
> been taken over by one of those search engines that sit on domain
> names.
>
> I went to go look in more detail.
>
> I knew eToys did prototype or instance based programming, but never
> new how. I also didn't know there was a concept called UniClasses. I'm
> fairly well read on Squeak (been on the list since 96-97), reviewed
> Guzdial's blue book, read his white book, Steph's robot book, and I'm
> working through SBE.
>
> I've recently been hearing a lot about singleton methods from Ruby, so
> that's why I chimed in.
>
> Thanks for the redirect. Will start learning more about UniClasses!
> On 9/19/07, Bert Freudenberg <bert at freudenbergs.de> wrote:
>   
>> In Squeak this is usually called "uniclasses" (for Unique Class) as a
>> way to add methods to instances. It's in the base system - send
>> #assureUniClass to the instance.
>>
>> What's the difference of this to #becomeSingleton?
>>
>> - Bert -
>>
>> On Sep 19, 2007, at 3:50 , David Mitchell wrote:
>>
>>     
>>> 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
>>> objects.
>>>
>>> http://map.squeak.org/accountbyid/04ec7571-cb7e-47ea-
>>> b1fc-218f7ec45adc/package/9d63f342-30e3-4db2-8695-3d65ccf28100
>>>
>>> "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
>>> object-by-object basis."
>>>
>>> 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?
>>>>>>             
>>>>
>>>>
>>>>         
>>
>>
>>
>>
>>     
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Singletons-avi.1.mcz
Type: application/octet-stream
Size: 1708 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070919/1b9a8428/Singletons-avi.1.obj


More information about the Squeak-dev mailing list