Geir Magnusson Jr. wrote:
This would be of much use, wouldn't it...

Yes, we can add the [ <ref> [, <ref>]* ] (whatever :) - I can't see much of a downside there. We do the same thing in Velocity and it's very useful.

We also allow ranges with similar notation -

[1..10]

returns an ArrayList with Integers 1..20 inclusive

the one question I'd ask is what would the array be? In vel we use an j.u.ArraList as the implementation, rather than an array [], which I think is much nicer.

> Comments?

Great, thanks for the response.

While an ArrayList is probibly the most generic solution, optimal solutions could "save memory" by detecting and instantiating an array of the proper type. Take situations like this:

<j:set target="${model}" property="foo" value="${[1..500]}"/>

If foo is of type int[] it would be reasonable to instantiate the appropriate int[] for that particular "return".

Its tough, at first I was thinking that in Jelly the object that is being "targeted" with the "property" will have a getter/setter of a specific type { primitive[] or ArrayList... }. But JEXL probibly has no detection concerning this type (Does it?). I wish it were possible to determine a return type of the evaluation and somehow return an object of that specific type.

If there's no return type detection in JEXL, then maybe there's some solution available in the "syntax"

double[ 0.1, 0.2 ] --> a double[]
int[ 1, 2 ]    --> an int[]
primitive[...]     --> ...

[1, 2, 3] --> an ArrayList



I really like the ranges idea as well and could really use a feature like that in my modelling taglibrary.

If its something thats relatively easy to do, great. I might be able to volunteer some dev time if you would like a hand. I did some primitive[] type detection in my BCEL taglibrary and in a Swing TableModel dealing getting/setting primitive Arrays in objects via table models.

-thanks,
Mark Diggory
http://repast-jellytag.sourceforge.net


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to