[ 
https://issues.apache.org/jira/browse/VELOCITY-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674784#action_12674784
 ] 

Byron Foster commented on VELOCITY-696:
---------------------------------------

Syntax styles are difficult because everyone has an opinion on what looks good, 
but I think for the reasons given by Claude in VELOCITY-680 it looks cluttered 
to me.  Also, given the way directives are parsed I speculate that it may be 
difficult to get the parser to cooperate.

I don't think #for is that much of a user option beyond any custom plugin a 
user writes for Velocity.  I didn't intent for anything in the contrib 
directory to be available to user's out of the box, or be officially mentioned.

<digress> 
The whole custom directive thing is actually very powerful, and under utilized 
me thinks.  2.0 may be well served to formalize the API a little, and maybe add 
a discussion in the developer guide.
</digress>

Anyway, I have no issue with implementing a 'hasNext' keyword.  I even 
considered throwing it in for completeness. so yes, both #foreach($a in $b 
hasNext $n) and #foreach($a in $b index $i hasNext $n) would work.

I wouldn't cry over removing $velocityHasNext or $velocityCount :), but I 
wonder about maybe a little backward compatibility.  Official support and 
documentation could be dropped in 2.0, and state a warning that they'll be 
completely removed in future releases.  I don't know, I could go either way.



> Add index parameter to #foreach directive to define an index variable
> ---------------------------------------------------------------------
>
>                 Key: VELOCITY-696
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-696
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 2.0
>            Reporter: Byron Foster
>
> Allow the following:
> #foreach($user in $users index $i)
> #end
> So that $i holds the current index number of the iteration.  This is similar 
> in functionality to the implicitly defined index variable, except this is 
> more explicit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to