Blocks and it's temp vars

Klaus D. Witzel klaus.witzel at cobss.com
Sat Dec 8 19:26:10 UTC 2007


This is a known consequence of the (so called old) compiler not doing  
BlockClosures.

The Seasiders often know that and make use of #fixTemps

  results add: [Transcript cr; nextPutAll: (stuff
at:i);flush] fixTemps

which eliminates this very problem problem :)

/Klaus

On Sat, 08 Dec 2007 20:08:02 +0100, Sebastian Sastre wrote:

> Hi there,
>
> 	working with callbacks in Seaside I've found this code don't
> evaluate properly in Squeak
>
> 	stuff := #(foo bar).
> 	results := OrderedCollection new.
> 	1 to: 2 do:[:i|
> 		results add: [Transcript cr; nextPutAll: (stuff
> at:i);flush]].
> 	results do:[:e| e value].
>
> 	It complains about stuff array not having 3 elements (?!). Seems
> that it has some problem with block temps. I saw a Seaside method trying  
> to
> separate the temps of the block from the ones of the method and at that
> point the block temps was already malformed. The previous code is to  
> expose
> this problem.
>
> 	Tested on 3.9.final.7067 and 3.10 gamma.7159 (a couple of non Squeak
> smalltalks works as expected).
>
> 	I need this feature badly so if anyone can give me any clue or
> workaround would be great,
>
> 	thanks,
>
> Sebastian
>
>
>





More information about the Squeak-dev mailing list