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

Randal L. Schwartz merlyn at stonehenge.com
Wed Aug 4 14:43:17 UTC 2010


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

John> How about:
John> test1

John> | block w z |
John>  w := 3. z := 12.
John> block := { [ :a :b | Transcript show: a asString , '   ' , b asString; cr ]
John> . w . z }.
John> w := 0. z := 1.
John>  (block at: 1) value: (block at: 2) value: (block at: 3)

Yeah, now that closures work, you could effectively curry the values:

    | block w z |
    w := 3.
    z := 12.
    block :=
      [:captureW :captureZ |
        [Transcript show: captureW asString , ' ' , captureZ asString; cr]]
          value: w value: z.

    w := 0.
    z := 1.

    block value.  "should still show 3, 12"

There might even be a method for that... or it might have just been
Seaside specific.

In fact, that's sorta what fixTemps did before. :)

-- 
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