In VTL, you can create two kinds of array objects, an 'Object Array',
and a 'Range' :

#set( $foo = ["a","b","c"] )
#set( $foo = [1..5] )

and use them in #foreach() or pass them to a method or VM.

The current implementation is an Object[].  The downside of this is that
we can't find out the size of the array in VTL, because in VTL we don't
allow access to object fields, just methods. (This is not bad... this
isn't what I am getting at...)

What I want to do is change the implementation of ObjectArray and Range
from Object[] to ArrayList, so we can then access the size() member, and
also, it would be more convenient overall. Now, you might say "Why do I
need to get the size, since I just created the thing and can see it here
in my template?".  One answer is that when one of these is passed into a
VM, the VM author can't know what the size is.  (And I am sure there are
other answers... :)

The problem : when I do this, things will break.  Specifically, any
methods of classes that you currently call from VTL that currently
accept Object[] as an argument will have to change. I will take care of
cleaning up everything in Velocity, but I am sure there are things out
there that will break.

So the question is (assuming no one has a big problem with this) is when
and how?  I can do it to the Range object easily enough as no one uses
that yet, but want to do both together for consistency.

geir

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Reply via email to