[Seaside] #call: #show: #home
William E Harford
seaside at harford.org
Tue Oct 11 10:34:52 UTC 2005
I misunderstood the methods' function.
Is there a reason that WAComponent does not keep a reference to it's
It appears WAComponent are singly linked. Any comments on why this was
done? Would there be any major disadvantages in keeping a reference to
the parent component in WAComponent? It would be nice if one could
traverse upward along the chain (Ofcourse a simple subclass would do
this but I am more interested in knowing why it was done the way it was
On Tue, 2005-10-11 at 07:21 +0200, Lukas Renggli wrote:
> > I assume that #home should return you to the first component in a chain
> > of called components. So component 1, calls component 2, calls component
> > 3, and executing `self home` from component 3 should return you to
> > component 1. Is that correct ?
> No, #home removes all the delegation-decorations. This means if you
> want to go back to component 1 you have to call home on component 1.
> On component 3 it has no effect, after all it wouldn't know how far it
> should go back in the chain of called-components, so call #home on the
> component you want to show again.
> > #show appears to be behaving exactly like #call. I assumed that show
> > would replace the current component with the shown component but it
> > appears to delegate. Turning on halos show this.
> In most cases #show: works similar to #call:, but there is an
> important difference: #call captures a continuation before actually
> #show-ing the called component. This makes it possible to have a flow
> of pages where you call each component and get the result.
> a := self call: aFirstComp.
> b := self call: aSecondComp.
> c := self call: aThirdComp.
> #show does not return a result (from #answer). However you can do
> basically the same using continuation passing style with
> #show:onAnswer:, but this is less natural and starts to become
> complicated if you have flows with loops and conditions.
> self show: aFirstComp onAnswer: [ :a |
> self show: aSecondComp onAnswer: [ :b |
> self show: aThirdComp onAnswer: [ :c |
> ... ] ] ]
> I suggest that you always use #call:, it works as expected in all cases.
> > Instead of calling and delegating to another component (presumably to
> > wait for an answer) I would like to replace the current component with
> > the called one. I could do this by putting my main navigation element
> > outside of the called component but in this case it is not the most
> > fitting approach.
> Store a reference to the parent component in you child and do a call
> on the parent, as you can see in WAParentTest.
> Lukas Renggli
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the Seaside