[Zope3-dev] Re: tal:define="..." considered harmful?
Tonico Strasser
contact_tonico at yahoo.de
Mon Feb 13 10:37:10 EST 2006
Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lennart Regebro wrote:
>> On 2/13/06, Tonico Strasser <contact_tonico at yahoo.de> wrote:
>>
>>> Looking forward to see explicit ZPTs soon :)
>>
>> Me too. I'd also like the macros to be called rather than expanded, so
>> that any error messages report the error in the macro rather than in
>> an expanded main template. This should be possible if we have explicit
>> macro parameters.
>>
>> In fact, this would not only solve the two biggest problems with
>> macros, it would make the macros functions, which is much better. If
>> we don't want to break backwards compatibility, calling them functions
>> would be a good idea.
>
> That's a non-goal for me: macros are *not* functions, and aren't
> supposed to be "called": the point of them is that they operate in the
> context of the caller. In addition to the loss of functionality (slots,
> as you note), calls are much more expensive than macros.
Hi Tres,
I'm interested in your opinion about parameters for macros.
Do you think this is explicit enough?:
<ul tal:define="list main_navigation">
<li metal:use-macro="macros/li_repeat"/>
</ul>
Or do you think explicit parameters would make things clearer?:
<ul>
<li metal:use-macro="macros/li_repeat"
metal:with-params="list main_navigation"/>
</ul>
Tonico
More information about the Zope3-dev
mailing list