[Seaside] Re: [squeak-dev] Re: BlockClosure vs BlockContext
John Chludzinski
john.chludzinski at gmail.com
Wed Aug 4 16:44:26 UTC 2010
So what are the semantics to BlockClosure's? When are the values of temps
bound to the block?
On Wed, Aug 4, 2010 at 11:02 AM, Randal L. Schwartz
<merlyn at stonehenge.com>wrote:
> >>>>> "Randal" == Randal L Schwartz <merlyn at stonehenge.com> writes:
>
> >>>>> "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)
>
> Randal> Yeah, now that closures work, you could effectively curry the
> values:
>
> Randal> | block w z |
> Randal> w := 3.
> Randal> z := 12.
> Randal> block :=
> Randal> [:captureW :captureZ |
> Randal> [Transcript show: captureW asString , ' ' , captureZ
> asString; cr]]
> Randal> value: w value: z.
>
> Randal> w := 0.
> Randal> z := 1.
>
> Randal> block value. "should still show 3, 12"
>
> Randal> There might even be a method for that... or it might have just been
> Randal> Seaside specific.
>
> Ahh yes, #cull:cull:
>
> | block w z |
> w := 3.
> z := 12.
> block := [:newW :newZ | ... ] cull: w cull: z.
> w := 0.
> z := 1.
> block value.
>
> Should do it.
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100804/114667c4/attachment.htm
More information about the seaside
mailing list