[Templates] naming conflict

Perrin Harkins perrin@elem.com
Mon, 11 Mar 2002 12:55:31 -0500


Matthias.Dillier@snb.ch wrote:
> After the FOREACH-loop, the array i.array is no longer defined. Surely, I
> can use other names, but they would be less intuitive in my real examples
> and I would have to change quite a lot of them.

TT does not support variables of multiple types with the same name in 
the stash.  It intentionally blurs the lines between variable types in 
order to keep template coding simple.  Remember, this is not perl.

No offense, but what you're doing here already seems very intuitive to 
me.  You're reusing variable names (which are already too short to be 
meaningful) for totally different things and hoping TT will guess their 
types correctly.

I suppose you could make an argument that TT should localize loop 
variables, but it still seems like you're asking for trouble with this.

- Perrin