[Newbies] Re: Removing 'dead' instances

Randal L. Schwartz merlyn at stonehenge.com
Mon Sep 29 02:03:46 UTC 2008


>>>>> "Andy" == Andy Burnett <andy.burnett at knowinnovation.com> writes:

Andy> I was wondering exactly that myself. After my 'doh!' moment, when Randal
Andy> explained what I was doing wrong, I was trying to work out why I had made
Andy> the mistake. The conclusion I came to was that I was becoming so used to
Andy> sending messages to objects, that I had confused myself into thinking that I
Andy> was somehow sending 'become nil' to the object stored in :each.

In a system where #become: is a two-way swap, rather than one-way, you *never*
want to send "become: nil".  That'd break everything, since now the value
of "nil" would be your other object. :)
The "safe" way to "become:" something innocent is often "become: String new".
Even so, it's (a) very slow on Squeak and (b) a bit shocking to the holder
of the value, who still expects the old object at its referenced oop.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list