[Seaside] Re: [squeak-dev] Re: BlockClosure vs BlockContext

Randal L. Schwartz merlyn at stonehenge.com
Wed Aug 4 14:38:29 UTC 2010


>>>>> "John" == John Chludzinski <john.chludzinski at gmail.com> writes:

John> When I try:
John> test1

John> | block w z |
John>  w := 3. z := 12.
John> block := [ Transcript show: w asString , '   ' , z asString; cr ].
John> w := 0. z := 1.
John>  block value.

John> I get: 0  1.  And NOT: 3  12, which are the values at the point of
John> definition.

John> How do I force the binding to (3 12)?

That's not how closures work.  I would have expected 0 1 as well.

If you want 3 12, you need to not update the one and only w and z later
in the method.

-- 
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 seaside mailing list