Should every kernel class x provide support for (x new)
printString and (x new) hash
Klaus D. Witzel
klaus.witzel at cobss.com
Sun Jan 21 15:29:42 UTC 2007
Hi Bert,
on Sun, 21 Jan 2007 13:41:01 +0100, you wrote:
> Am Jan 21, 2007 um 11:51 schrieb Klaus D. Witzel:
>
>> Hi folks,
>>
>> on the beginners list Brent McConnell reported a situation in which
>> (Collection new) was assigned to an automatic declared variable x and a
>> subsequent (x := OrderedCollection new) still called for the dubugger,
>> because aDictionary(Set) relies on ((Collection new) hash) for already
>> declared variables.
>
> Interesting find - I couldn't believe it when I read it, but it is
> indeed as Brent says.
>
>> You can provoke the walkback with printIt on
>>
>> (Collection new) hash
>>
>> but also on
>>
>> (Collection new)
>
> IMHO that's not the actual problem at hand, but rather, that compiling
> an assignment breaks depending on the previous *value* of the binding.
Even more so: just do a recompile on any method on the class side of
Unicode. Doing the binding of class var GeneralCategory (Unicode
generalCategory size => 917632), same with class var DecimalProperty, this
takes ages.
Ever switched a browser to the class side of Unicode and then tried to
select some method? Try to recompile #generalCategory after adding some
whitespace.
> We should fix that. Reproduce be evaluating these two lines *separately*
> in a Workspace:
>
> c := Collection new
>
> c := 42
>
>> Q: wouldn't it be noob-friendlier if *all* kernel classes avoided the
>> debugger in doIt/printIt situations?
>
> You mean I should be able to write "1 / 0" and not get a debugger? ;-)
Nada, the situation was described in the subject line and has nothing to
do with programmer's new mistakes.
Just with the downloaded kernel classes' implementation of #printString,
obviously the first place where beginners get in touch with Smalltalk's
objects. What's the problem with the kernel classes being polite to noobs
in a workspace, would that be too much for Smalltalk ;-)
> I don't think so. I also don't think that is necessary, I guess you try
> to instantiate an abstract Collection only once.
Once per class during the rest of your life as Smalltalker, and only if
you ever do #printString and/or #hash before going production. Smalltalk
size => currently 2887 in my dev-image.
/Klaus
> So my answer to your subject's question would be a clear "no". *If* we
> wanted to be newbie friendly we would make "Collection" an alias to
> "OrderedCollection" so you can actually work with it. I'd be opposed to
> that suggestion, too, of course ;)
>
> - Bert -
>
>
>
>
More information about the Squeak-dev
mailing list
|