* Andy Wardley ([EMAIL PROTECTED]) [010925 09:09]: > On Tue, Sep 25, 2001 at 09:02:13AM -0400, Chris Winters wrote: > > ... Still, I'm curious if putting all the > > MACRO/BLOCK items in a file is the best way to create a common > > library. > > Not really. A MACRO is created as a closure to localise the stash, > do whatever it is that you want to do, delocalise the stash, then > return. > > So it's slightly slower than calling direct as you've got an extra > subroutine to call and you always get localisation of variables so > you lose any benefit of doing: > > [% MACRO foo PROCESS foo %]
The fact that it's localising the variables every time is a good thing, IMO, since there won't be any unintended consequences of variable changes within the BLOCK. And if people want to do so, they can define their own bare (non-MACRO) BLOCKs and call them with PROCESS. > I suspect that the other Bad Thing is that the MACRO closures are > being re-defined for each template you process whereas you actually > want them created just once. > > There should be a better way to do this. Maybe a PRE_PRE_PROCESS > option to process a template(s) once when the engine fires up instead > of processing it before each template? That would be excellent! Thanks, Chris -- Chris Winters ([EMAIL PROTECTED]) Building enterprise-capable snack solutions since 1988.
