[Seaside] Seaside and Dynamic variables
avi.bryant at gmail.com
Thu Nov 17 04:53:03 CET 2005
On Nov 16, 2005, at 9:14 AM, David Shaffer wrote:
> had a case last night where I needed a dynamic variable but didn't
> its value on the first invocation...so, I used this pattern:
> SomeSession>>start: aRequest
> ^Bindings clamp: [^super start: aRequest] "this gets me one
> dynamic binding context use for all future requests to this session"
> and either:
> SomeSession>>someVariable: aValue
> ^#someVariable binding: aValue
> SomeSession>>withEscapeContinuation: aBlock
> #someVariable binding: someValue.
> ^super withEscapeContinuation: aBlock
> This seems to work very well and prompts me to wonder if we should
> the first version of the pattern. Am I nuts? The "once in and out"
> per request of withEscapeContinuation: makes it useful for database
> session creation etc but not so useful for dynamic variable binding.
> I'd like to add this to the FAQ if I'm not right...just want some
> independent confirmation that this is a reasonable pattern.
This stuff always makes my head hurt :)
I'm a little bit surprised that we stay in the same dynamic context
even across a #call: with your method. Are you sure that you do?
Can you explain why it works?
Generally, for the kind of thing you're describing I'd guess the most
reliable (or at least simplest to understand) method would be to
subclass WASession and add an ivar to store your variable. That
might couple things too tightly to Seaside in some cases, however.
More information about the Seaside