[Newbies] Re: Recap: How to empty a collection

Blake blake at kingdomrpg.com
Wed Feb 20 00:27:14 UTC 2008


On Tue, 19 Feb 2008 15:59:57 -0800, nicolas cellier <ncellier at ifrance.com>  
wrote:

> However, there are plenty of ordinary things that would have the same  
> result:
>
> | key1 key2 dic |
> key1 := 'abc' copy.
> key2 := 'abd' copy.
> dic := Dictionary new.
> dic at: key1 put: 1.
> dic at: key2 put: 2.
> key1 at: 1 put: $z.
> {dic includesKey: key1.
> dic keys includes: key1.}
>
> So i propose newbies do not use #at:put: considering the danger about  
> Dictionary not finding their keys...

This seems pretty bad to me, too, but it seems more designed to break a  
known weakness than to actually accomplish something. You know, like empty  
a collection.<s>

But I'd probably argue that the above should work, and that it's a design  
flaw that it doesn't.

> Anyway, why do you think all code is accessible in Smalltalk?
> In the spirit, nothing is to be hidden from newbies eyes.
> Yes I know, maybe some code should

There's a positive fetish about this. I'm all for everything being  
accessible. But everything being equally accessible all the time is not  
pragmatic.


More information about the Beginners mailing list