[Seaside] Unexpected callback behavior
Randal L. Schwartz
merlyn at stonehenge.com
Sat Dec 8 19:12:21 UTC 2007
>>>>> "Sebastian" == Sebastian Sastre <ssastre at seaswork.com> writes:
Sebastian> At first I was suspecting about the #fixCallbackTemps but the block
Sebastian> was already malformed when reach that point. Investigating about this I'm
Sebastian> surprised to found that it's related to Squeak being unable to do properly
Sebastian> this smalltalk code:
Sebastian> stuff := #(foo bar).
Sebastian> results := OrderedCollection new.
Sebastian> 1 to: 2 do:[:i|
Sebastian> results add: [Transcript cr; nextPutAll: (stuff at:
Sebastian> results do:[:e| e value]
I believe that this is a place where you need the fixTemps call on the block.
Did you try this as:
1 to: 2 do: [ :i |
results add: [
nextPutAll: (stuff at: Sebastian> i);flush
As in, notice the difference between:
((1 to: 3) collect: [:i | [i]]) collect: [:aBlock | aBlock value]
=> #(3 3 3)
((1 to: 3) collect: [:i | [i] fixTemps]) collect: [:aBlock | aBlock value]
=> #(1 2 3)
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 seaside