Christoph Reck wrote:
> 
> If I get this right, VM are currently allways global?

Yes, they are currently accessable by all templates.
 
> This whould be another reason for making VM access into
> references (using '$' and not '#'). They should be placed
> into something called a 'base context' which is cloned on
> each request. Local VMs are then volatile!

Noooooooo. :)
 
> I believe some documentation is needed on the context of
> a VM:
>   * Where does a VM live - in the context or in the
>     directive look-up-table?

Neither. They have their own home, which you can consider to be like
their own directive look-up table...

>   * What references/variables does it see internally -
>     only the passed ones or all of the current context?

They have access to the current context like any other piece of VTL.

>   * What happens with local #set's, are they visible
>     after the VM returns?

Of course.  Like any other VTL.  (It's not really a subroutine)

>   * What happnes with local #set's when they have the
>     same name as in the global context?

There is no 'global context' per se.  Generally, each is associated with
the thread of execution using Velocity. (Right : most people will do a
Context c= new Context() in their own code, or the servlet base class
does it for them...)  Right now, it's expected that the Context object
is per-thread.  In the current implementation, there might be problems
if you share the Context across threads. (Same with WM).

>   * It seems that it is strongly recommeded to place
>     VMs into libraries, which are loaded on startup.

Yep!

>     Local VMs may be used within a template if the
>     configuration allows it. 

Yep!

>     The issue of this thread
>     is to clarify if these VMs live past this template
>     access and are accessible from other templates.

Yep!  They currently do.  I pretty much think it would be straight
forward for me to put in a  switch (property) that will allow VMs
specified in a template to be only visible to and used by that template.
(And we ain't making them references...:)

geir


> Thanks in advance for clarifications.
> 
> :) Christoph

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]

Reply via email to