[ZPT] Re: [Zope3-dev] TAL Macro Parameters

Shane Hathaway shane at zope.com
Fri May 23 10:43:17 EDT 2003


Chris Withers wrote:
> Shane Hathaway wrote:
>  > Comments are welcome.  To avoid cross-posting, Wiki comments are
>  > preferred over email comments.
> 
> Yes, but the number of people who read Wiki comments is pretty small ;-)
> 
>> Ken and I brainstormed a way to solve a problem with METAL.  METAL 
>> macros often need parameters, but the language does not support them. 
>> Here is our proposal:
>>
>> http://dev.zope.org/Wikis/DevSite/Proposals/MacroParameters
> 
> 
> I'm with Magnus on this one. METAL has always just been about textual 
> substitution. Turning it into something akin to a function call seems 
> like a complexity nightmare :-S

People are already using it that way, however, and the current syntax is 
causing pain.  As stated in the proposal: "We believe the current 
implicit parameter passing scheme leads to much greater operational 
complexity, in confusion about the source of values and code complexity 
in providing for missing settings."

> The proposed syntax also seems confusing.
> 
> If this is _really_ required, perhaps a 'metal:parameters' syntax could 
> be added, which would make your examples:
> 
> <div metal:define-macro="standard"
>      metal:parameters="a;
>                        b;
>                        c python:0">
> 
> <div metal:use-macro="here/main_template/macros/standard;"
>      metal:parameters="a string:x;
>                        b somevar">

That is probably more readable.

> Finally, under the proposed code, how would you go about getting things 
> to behave like thery do now?

You just don't provide or require parameters.  Variables will still 
behave as they do today.

Shane




More information about the ZPT mailing list