Continuation question

Julian Fitzell julian at beta4.com
Fri Feb 27 16:48:18 UTC 2004


Mm... well it's not particularly.  By using continuations you add 
another way (aside from straightforward loops) in which code may get 
evaluated more than once (allowing the closure issues to surface).

Seaside uses #fixTemps mostly for callbacks, which are not implemented 
using continuations.  They are simply stored blocks (see 
WAValueCallback) and they need #fixTemps called on them before they get 
stored.

If you were looping over a list making callbacks and not calling 
#fixTemps, then all your callbacks would end up acting on the last list 
element, for example.  I think there could also be a problem if a 
callback was created in a method context that was already on the stack 
when the continuation for the page rendering is made, since the next 
time that page gets rendered the callbacks would take on the values from 
the second rendering pass.

Honestly I'm not awake enough to be sure I'm right on that very last 
part.  Seems like it's right in theory but I can't actually think 
whether it ever happens in practice.  We got all the #fixTemps bugs out 
of Seaside quite a while ago (we hope) and I haven't had to think about 
it in many months. :)


Julian


Alexandre Bergel wrote:
> But how this fixStemps is related to the class Continuation?
> 
> Alexandre
> 
> On Thu, Feb 26, 2004 at 09:30:05AM -0800, Julian Fitzell wrote:
> 
>>Alexandre Bergel wrote:
>>
>>>Hello!
>>>
>>>The following yield 2 because Squeak does not support any full closure.
>>>
>>>|t blocks| t := [:x| [x]]. blocks := Array with: (t value: 1) with: (t 
>>>value: 2). blocks first value
>>>
>>>But what is the equivalent with Seaside? I would like to understand better 
>>>how Seaside works...
>>
>>I'm not exactly sure what you're asking.  Seaside tends to get around 
>>the lack of full closures by using #fixTemps in key places.  So in this 
>>case:
>>
>>|t blocks| t := [:x| [x] fixTemps]. blocks := Array with: (t value: 1) 
>>with: (t value: 2). blocks first value
>>
>>should return the value (1) you are expecting...
>>
>>Not sure if that answers your question or not,
>>
>>Julian
>>
> 
> 





More information about the Squeak-dev mailing list