#with: and #children: is one redundant?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

#with: and #children: is one redundant?

Sophie424
If I call #with: on a canvas/brush and pass a sub-component, why do I also
have to register that sub-component in #children:

Would it make sense for the #with: to do the needed registration?

Thanks!



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #with: and #children: is one redundant?

Lukas Renggli
> If I call #with: on a canvas/brush and pass a sub-component, why do I also
> have to register that sub-component in #children:

Theoretically yes. Practically no.

We could do a null-render pass before the actual rendering pass to
collect these children. However that could potentially be very
expensive and cause troubles because people do not behave and change
state or do other bad things that they shouldn't during the rendering
;-)

The children need to be known in advance to be able to evaluate
callbacks such as #initialRequest:, #updateRoot:, #updateUrl:,
#states, ...

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #with: and #children: is one redundant?

Sophie424

"Lukas Renggli" <[hidden email]> wrote in message
> We could do a null-render pass before the actual rendering pass to
> collect these children.

Instead of a separate fake-rendering pass (with its inefficiency + risks as
you pointed out), why not just have #with: directly register the #children
for the common cases when it is directly passed a component? Of course I
could be totally misunderstanding how it works ...



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: #with: and #children: is one redundant?

Lukas Renggli
> > We could do a null-render pass before the actual rendering pass to
> > collect these children.
>
> Instead of a separate fake-rendering pass (with its inefficiency + risks as
> you pointed out), why not just have #with: directly register the #children
> for the common cases when it is directly passed a component? Of course I
> could be totally misunderstanding how it works ...

The children need to be known **before** the actual rendering pass.

For example, if you want your visible components to be able to add
elements to the <head>, then you need to call their #updateRoot:
method before you let them generate the <body>. At the time the <body>
is rendered the <head> might already have left the server and is on
the way to the client (when using a streaming server at least).

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: #with: and #children: is one redundant?

Avi Bryant-2
On 10/19/07, Lukas Renggli <[hidden email]> wrote:

> For example, if you want your visible components to be able to add
> elements to the <head>, then you need to call their #updateRoot:
> method before you let them generate the <body>. At the time the <body>
> is rendered the <head> might already have left the server and is on
> the way to the client (when using a streaming server at least).

And there's a redirect between #children being asked to #updateUrl:,
and being rendered to the <body> - so it's not just in the streaming
server case that it matters.

Another count against a null rendering pass is that in many cases this
would double the response time, since all database queries etc would
get (needlessly) executed twice.

Avi
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: #with: and #children: is one redundant?

Sophie424
Ah, I get it. Thanks Lukas and Avi. I was just hoping to DRY it a bit more.

"Avi Bryant" <[hidden email]> wrote in message
news:[hidden email]...

> On 10/19/07, Lukas Renggli <[hidden email]> wrote:
>
>> For example, if you want your visible components to be able to add
>> elements to the <head>, then you need to call their #updateRoot:
>> method before you let them generate the <body>. At the time the <body>
>> is rendered the <head> might already have left the server and is on
>> the way to the client (when using a streaming server at least).
>
> And there's a redirect between #children being asked to #updateUrl:,
> and being rendered to the <body> - so it's not just in the streaming
> server case that it matters.
>
> Another count against a null rendering pass is that in many cases this
> would double the response time, since all database queries etc would
> get (needlessly) executed twice.
>
> Avi



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside