[Seaside] Garbage Collection/Handling

Lukas Renggli renggli at gmail.com
Fri Apr 13 12:24:01 UTC 2007


> Rootcomponent>>children
>     ^Array with: SomeComponent new.
>
> Rootcomponent>>renderContentOn: html
>     html render: SomeComponent new.

That wont work due to different reasons:

- The object you return from children is not the same object that you
render in #renderContentOn:

- With every request you create a new instance of SomeComponent and
loose all the existing state. You should never need to initialize
components in rendering code.

> Now, that is a *very* simple example - but it does demonstrate what I am
> referring to - there are now two instances of SomeComponent, when only
> one is needed. This will be resolved by a lazy loader, but for more
> complex examples it is not easy.

This is standard:

Rootcomponent>>initialize
     super initialize.
     some := SomeComponent new.

Rootcomponent>>children
     ^Array with: some

Rootcomponent>>renderContentOn: html
     html render: some

> I am still learning with Seaside, but so far I can see that the
> #children are then processed with #childrenDo: but I still ask "Why?"
> Why must they have this processing here, and not at rendering?

Because Seaside is stateful. It needs the children information to
process callbacks, to render the <head>, to enable REST-ful URLs and
probably other things ...

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Seaside mailing list