On Thu, 2005-01-06 at 11:08 +0000, Andy Wardley wrote: > I must admit it worries me slightly that I come down 90% in favour of one > approach and you're swung 99.9% the other way. Assuming the efficiency > problem goes away in TT3, is your position that non-localising is the > correct behaviour by default, or rather that the name of the directive > "INCLUDE" suggests that the template is processed inline and thus the > user is expecting the variables to be imported, regardless of whether > this is the more useful behaviour or not?
It's both of those. I think that: - The current version of INCLUDE can be a significant performance hit for templates with lots of INCLUDE calls (vs. PROCESS). - It's not technically possible for localising (the UK spelling! my e-mail client is freaking out!) to be as fast as not localising in TT3. - Most people don't even know that INCLUDE has this behavior and might not want it if they did know. This is what I draw from the surprise that people always express when this comes up on the list. - The word "INCLUDE" clearly implies it is the normal way to call other templates. - The word "INCLUDE" makes it sound like templates are being inlined. Although people on the list talk about setting variables inside of templates, I think this is quite rare in normal usage. The only thing I see people do frequently is pass variables in macro and include calls, which is why I like the suggestion Mark Mills just made: localise those variables, and leave everything else alone. I also favo(u)r having a localising version with another name, like LINCLUDE or SAFE_INCLUDE. PROCESS vs. INCLUDE only makes sense to someone who knows the internals. How backwards-compatible do you intend TT3 syntax to be? At one point, I remember we were talking about configurable grammars, which would mean that you could have one that works the current TT2 way and a new one that works the way I'm describing. - Perrin _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
