|
Re: Recap: How to empty a collection: msg#00128lang.smalltalk.squeak.beginners
Blake a écrit : On Tue, 19 Feb 2008 15:08:56 -0800, nicolas cellier <ncellier@xxxxxxxxxxx> wrote: I see, become: does exchange #identityHash, and that makes our IdentityDictionary work, god thanks, but there is no such provision for ordinary #hash and Dictionary... 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... That's too much. becomeForward: is squeakish, but the thread was about Squeak implementation of a core library... A rule is to use becomeForward: only with a just created object as argument. But right, that's just too much for this thread. They are also a fantastic way to introduce bugs of various sorts, and can even cause an image to crash (as in, stack trace and exit to the OS). Say, for example, that one of the arguments you pass is accidently nil, true or false? Your image would c ontinue working... for a while." OK, good lesson, thank you. Handle with care. Try finding better patterns. Protect usage (don't use with an unknow argument). It smells. I agree. But don't pretend it's broken please. 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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How to empty a collection?, goran |
|---|---|
| Next by Date: | Re: How to empty a collection?, Jeffrey Straszheim |
| Previous by Thread: | Re: Re: Recap: How to empty a collection, Blake |
| Next by Thread: | Re: Re: Recap: How to empty a collection, Blake |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |