[Seaside] [goodie] Component naming framework

Derek Brans brans at nerdonawire.com
Tue Jun 17 22:52:15 CEST 2003


> On Sun, 15 Jun 2003, Derek Brans wrote:
>
> > The component captures a copy of the current naming context for use in
the
> > callback just before it renders itself.  See
> > WANamingComponent>>renderWithContext:
>
> Oh, I see, you save the dynamic bindings in an ivar of the class, and then
> use that for the lookup.  So the lookup isn't actually dynamic at all, or
> rather it's dynamic but in the rendering scope... ok, pretty messy, but it
> works.

I'm not sure if I undertand the limitation in dynamics here.  The bindings
can be changed at any time during rendering or in the callback, because
BindingsAccessor>>get returns a dynamic binding context which you can store
and use outside of the stack context.  This binding context is still
entwined with other contexts, from my understanding of DynamicBindings.

For example:

|temp1 temp2|
Bindings clamp: [
 #asdf binding: 'testValue'.
 temp1 _ Bindings get.
 Bindings clamp: [
  #qwer binding: 'something'.
  temp2 _ Bindings get]].

temp1 at: #asdf put: 'testValue2'.
temp2 at: #asdf (-- evaluates to 'testValue2')

WANamingComponent>>getRenderingBindings uses BindingsAccessor>>get.

>
> Except that you need to make your renderingBindings ivar a StateHolder, or

Good point.

> This isn't code I'm going to adopt immediately, but it's an interesting
> approach to keep in mind.

Thanks for the feedback.
Derek




More information about the Seaside mailing list