Perrin Harkins wrote:
> All I ask is that you name the fast non-localizing way that 99.9% of the
> world should be using "INCLUDE" and name the localizing way something
> else.  People constantly use the wrong one because of the names and
> don't even realize it.

Hi Perrin,

Yes, I agree that the difference between INCLUDE and PROCESS is confusing, 
and under TT2 the inefficiency of INCLUDE makes PROCESS the far better
choice if efficiency is an issue (although it's worth noting that for many 
TT users working offline, it isn't).

But under TT3 we can make the INCLUDE directive as fast as PROCESS currently
is in TT2 (give or take a bit), and still have it do the right thing with
respect to localising variables.

I would have thought that for most people, most of the time, the localising 
behaviour of INCLUDE was the more "correct" behaviour than PROCESS which 
effectively makes all variables global.  Perl subroutines keep parameters
and variables local by default, and Perl modules shouldn't export variables
or subroutines by default, so Perl templates should also "think globally,
but act locally" by default, by my way of thinking at least.

So I don't dispute what you're saying, but if we disregard the efficiency
concerns which we assume will be diminished in TT3, then my guess would be 
that perhaps 90% of the world should be using INCLUDE as it is, with its 
localising behaviour as it is, keeping PROCESS for those rarer occasions 
when they really do want variables and template BLOCKs defined in a template 
to be imported into the calling context.

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?

Cheers
A


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to