Blocks (Re: Fear and loathing of the "perification" of Smalltalk)

Randal L. Schwartz merlyn at stonehenge.com
Tue Sep 18 17:05:54 UTC 2007


>>>>> "Alan" == Alan Kay <alan.kay at vpri.org> writes:

Alan> Sure. I simply meant that a block containing an assignment to the
Alan> internal state of an object can be passed around willy nilly to other
Alan> objects and some random time in the future can be sent value and presto!
Alan> you've cause a side effect on the internal state of the object that will
Alan> be very hard to track down if it's a bug.

But that's no different from some other object holding a reference to your
object, then invoking a named method at a random time.

Putting dangerous things into a named method is no better or worse than
putting dangerous things into a closure/block.  You are still in control about
the damage that can be caused "from the outside".

In fact, I'd go so far as to argue that a closure is nothing more than an
unnamed method, and should be treated with the same care and feeding as named
methods.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



More information about the Squeak-dev mailing list