Should every kernel class x provide support for (x new) printString and (x new) hash

Klaus D. Witzel klaus.witzel at cobss.com
Mon Jan 22 08:39:47 UTC 2007


On Sun, 21 Jan 2007 21:23:54 +0100, Bert Freudenberg wrote:
> Am Jan 21, 2007 um 21:15  schrieb Ralph Johnson:
>
>> On 1/21/07, Klaus D. Witzel wrote:
>>> Hi Ralph,
>>>
>>> I have nothing to say against your arguments :) just asked if it is
>>> possibile to be more polite to potential converts when they begin  
>>> using a
>>> workspace :)
>>
>> Sure, it is good to be friendly.
>>
>> Perhaps change Collection>>do: to
>>
>> do: aBlock
>>  self class = Collection ifTrue: [self error: 'Collection is an
>> abstract class.  You should probably use OrderedCollection instead.'].
>>  self subclassResponsibility
>
> That's an excellent idea!

I agree. But it might create a problem for (re-)engineering tools, which  
expect "self subclassResponsibility" to be the one-and-only statement in  
such situations.

> Maybe we could even reword the notice in the general  
> subclassResponsibility method. In general, Squeak error messages are  
> quite unhelpful. Like, the first thing everyone encounters is a DNU for  
> nil - the message could be way more informative.

Also, agreed. Mind to sketch an example for the DNU text on nil, since I'm  
not sure that I understand what's wrong with the ages old DNU error text.  
Thank you.

>> Or maybe change #new to be
>>
>> new
>>  self = Collection ifTrue: [^OrderedCollection new].
>>  ^super new
>
> This one I do not like.

Me too. #new can only have one implementor (the primitive call done in  
Behavior) plus, ((aClass new) class == aClass) must hold, otherwise one's  
rather lost instead of being excited about Smalltalk :)

/Klaus

> - Bert -




More information about the Squeak-dev mailing list