[Seaside-dev] Automatic registration of children?

Lukas Renggli renggli at gmail.com
Wed Aug 18 13:18:14 UTC 2010


What about having a slow default implementation of #children that does
exactly what you describe and that can and should be overriden as we
do today to get efficent code?

Lukas

On Wednesday, August 18, 2010, Julian Fitzell <jfitzell at gmail.com> wrote:
> Hi Nicolas,
>
> I've often tried to think of something like this to remove the need
> for #children. The problem is that #children is used to support
> #updateRoot:, #updateUrl:, both of which happen (more or less by
> necessity, at least if you want to support streaming content) before
> rendering.
>
> I've thought of having maybe a dummy rendering context so you could do
> a fake render pass to collect the children before doing the real
> rendering. I think this would work as long as the rendering was
> side-effect free (it's supposed to be anyway) but I'm not sure what
> the performance overhead would be. The stream output operations would
> be no-ops, but any other computation, database access, etc. would
> still end up being performed a second time.
>
> Julian
>
> 2010/8/13 Nicolas Petton <petton.nicolas at gmail.com>:
>> Hi,
>>
>> Maybe I don't know Seaside enough and the following doesn't make sense,
>> but just in case..
>>
>> Back when I was playing around with Seaside, I always found quite
>> annoying to have to implement #children everywhere in my components and
>> feared to break the back button somewhere.
>>
>> We recently needed a #children like method in Iliad, so I thought about
>> other ways to do it.
>>
>> The idea is to use a dynamic variable (let's call it
>> WACurrentComponent). When rendering a component, we register can
>> children with something like:
>>
>> renderOn: aRenderer
>>    self withChildrenRegistrationDo: [
>>        ...
>>        ...]
>>
>> withChildrenRegistrationDo: aBlock
>>    children := OrderedCollection new.
>>    WACurrentComponent value ifNotNil: [:parent |
>>        parent registerChild: self].
>>    WACurrentComponent use: self during: aBlock
>>
>> registerChild: aComponent
>>    children add: aComponent
>>
>>
>> As I said, it works fine for us but maybe it won't for Seaside :)
>>
>> Cheers!
>> Nicolas
>>
>> _______________________________________________
>> seaside-dev mailing list
>> seaside-dev at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>

-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside-dev mailing list