Christoph Reck :
> geir :
>> 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] )
>>
>>[snip]
>> 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
> What happens with a:
> #set( $foo = [] )
> Will this be an empty ArrayList ?
Happy New Year!
If the parser doesn't hork a furball, yes I think that would be right. (And
will be fixed if not :) But whats the point?
I think we should encourage that kind of thing to be in the ' implicit API'
between the template and the app/servlet, to have an empty list (or Map as
in the next thing you write) placed in the context by the app/servlet layer,
rather than have the tempate add objects like this arbitrarily. The uses
then is not in a LHS of #set() but maybe passing into some kind of tool to
alter the ArrayList after creation.
These constructions, the ["a","b","c"] and [1..5], I think are there
fundamentally to let template designers set up their own interations and
sets for template use, rather than make objects to pass back to the
app/servlet layer. (MC).
> I would also vote in favour of a #set( $foo = {} ) usable to create
> a Map that can be populated via #set( $foo.KEY1 = "xyz" )... but this
> seems to be another issue :)
Yes.. :)
> Some of you have strong feelings against allowing the ASTSetDirective
> checking for a put method (ASTIdentifyer already has th notion of the
> get method!). Anyone in favour of adding the put notion to
ASTSetDirective?
I am coming around, actually, but not there yet. :) The Identifier has to
do it because of our introspection rules.