[Seaside] How to do the ubiquitous home button?

Colin Putney cputney at wiresong.ca
Mon Aug 25 17:52:48 CEST 2003


> HomeComponent>>drillDown
>   self catch: #home do: [self call: ChildComponent new].
>
> SomeChildOfTheChildComponent>>home
>   self throw: #home
>
> That would "unwind" any of the component #calls that had been done to 
> get
> to that point, until it found the catch for #home.

It like this. I like this a lot.

It does bring up the question of what to do with uncaught throws. I 
think just using the top-level component would be fine, but I could see 
the argument for raising an exception. Ruby does this, for example.

> A simpler way to do the same thing might be something like
>
> self returnTo: HomeComponent
>
> which would unwind until it found something of the appropiate class...

I don't like this. Methods shouldn't know about their callers,* and 
neither should components. The ability to write components that can be 
called from many places is what makes Seaside wonderful.

* There are exceptions to that rule of course, but I think they prove 
it nicely. Manipulating the call stack lets us do cool things like 
resumable exceptions and continuations. But I don't think we need that 
same kind of flexibility with components. Does anyone really need 
call/ccc? Metacontinuations, anyone? ;-)

Colin



More information about the Seaside mailing list