overridding without subclassing examples

Bert Freudenberg bert at freudenbergs.de
Wed Sep 19 21:11:49 UTC 2007


Ah, right. Guess I confused that with Tweak's uniclasses which are  
anonymous. It's the same concept still.

- Bert -

On Sep 19, 2007, at 23:07 , Travis Kay wrote:

> 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?
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
> <Singletons-avi.1.mcz>
>





More information about the Squeak-dev mailing list