Jose Alberto Fernandez wrote:
>
> I agree that Geir proposal is a little complicated even for me :-)
> But what I am asking is for something way more simple.
It wasn't really a proposal... just trying to get the discussion going.
> Being able to associate macros with the Template in which they are defined.
> So except for macros in the global libraries if you define macros in your
> template, they belong to your template and you cannot use it in another.
>
> This behavior could be controled by a runtime property, if you want.
That's reasonable. (Yes, I would want...)
> My point is that in any large shop, you will have people using the same
> name for unrelated macros. "#formatAccount". If they happen to run
> on the same JVM (or classloader) -- Velocity is not just for Turbine and
> Tomcat -- this people will get into conflicts and no one will know what
> is going on.
Yes and no. One thing to consider is that there are other resource
collisions that one has to manage in a large shop : libraries, packages,
templates, whatever. VMs would be another. And conflicts don't happen
silently : you can lock out the replacement of a VM if it is already
defined. This also produces log output, so it's not much of a mystery
if you watch your log.
> In any case, what are the rules when Templates are reloaded?
> Do I override the macro definition?
There is a runtime property that controls this.
> What if that definition came from
> another template.
Doesn't matter. Source of the VM isn't kept. The addition of a VM
definition is logged, although I was remiss in not outputing the name of
the template that did it. I will fix that tonight.
>Are we keeping track of all that? (I really do not know).
>
> Does it make sense for me to use a macro on one template that I did not
> define, and is not in the global library, but that is defined in some other
> template that I may not even be sure it has been loaded.
Well, that was the exact line of reasoning behind the idea that the
#macro() statement should not be allowed in a regular template : they
should be loaded at Velocity start.
> After all, if it is a library I should put it in the global place
> or I can loaded on each template using #parse of the template containing it.
>
> Does anyone see the problems I see with the current arrangement?
We all do, I think. :)
geir
> Jose Alberto
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."