You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Byron Foster (JIRA)" <de...@velocity.apache.org> on 2008/10/13 02:14:44 UTC
[jira] Created: (VELOCITY-630) Pass by name does not work with
#foreach within a macro
Pass by name does not work with #foreach within a macro
-------------------------------------------------------
Key: VELOCITY-630
URL: https://issues.apache.org/jira/browse/VELOCITY-630
Project: Velocity
Issue Type: Bug
Components: Engine
Affects Versions: 1.6-beta1, 1.5
Reporter: Byron Foster
GIven the following:
#macro(test $a $b)
#foreach($i in $a) $b #end
#end
#test( [1, 2, 3] "#if($i == 2) yes #else no #end")
I would expect the output:
no yes no
Instead, I get
no no no
The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org
[jira] Commented: (VELOCITY-630) Pass by name does not work with
#foreach within a macro
Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
[ https://issues.apache.org/jira/browse/VELOCITY-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640218#action_12640218 ]
Nathan Bubna commented on VELOCITY-630:
---------------------------------------
In this the "Strange pass by name behavior" thread on the dev list, Byron points out that the changes made for VELOCITY-285 don't fit with strict pass-by-name behavior. I'm convinced at this point. In the absence of any argument against that. I'm going to revert the relevant change in VELOCITY-285 in favor of resolving this issue. Here's the thread for anyone interested:
http://velocity.markmail.org/search/?q=strange%20pass%20by%20name#query:strange%20pass%20by%20name+page:2+mid:lb4czzlcndwizoz3+state:results
> Pass by name does not work with #foreach within a macro
> -------------------------------------------------------
>
> Key: VELOCITY-630
> URL: https://issues.apache.org/jira/browse/VELOCITY-630
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5, 1.6-beta1
> Reporter: Byron Foster
> Attachments: Velocity630TestCase.java
>
>
> GIven the following:
> #macro(test $a $b)
> #foreach($i in $a) $b #end
> #end
> #test( [1, 2, 3] "#if($i == 2) yes #else no #end")
> I would expect the output:
> no yes no
> Instead, I get
> no no no
> The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org
[jira] Resolved: (VELOCITY-630) Pass by name does not work with
#foreach within a macro
Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
[ https://issues.apache.org/jira/browse/VELOCITY-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathan Bubna resolved VELOCITY-630.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.6
Fixed in revision 705288.
> Pass by name does not work with #foreach within a macro
> -------------------------------------------------------
>
> Key: VELOCITY-630
> URL: https://issues.apache.org/jira/browse/VELOCITY-630
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5, 1.6-beta1
> Reporter: Byron Foster
> Fix For: 1.6
>
> Attachments: Velocity630TestCase.java
>
>
> GIven the following:
> #macro(test $a $b)
> #foreach($i in $a) $b #end
> #end
> #test( [1, 2, 3] "#if($i == 2) yes #else no #end")
> I would expect the output:
> no yes no
> Instead, I get
> no no no
> The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org
[jira] Updated: (VELOCITY-630) Pass by name does not work with
#foreach within a macro
Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
[ https://issues.apache.org/jira/browse/VELOCITY-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathan Bubna updated VELOCITY-630:
----------------------------------
Attachment: Velocity630TestCase.java
Don't have much time to go after this today. Here's a test case for both VELOCITY-285 and this one. Guess we need to find a way to get both to pass.
> Pass by name does not work with #foreach within a macro
> -------------------------------------------------------
>
> Key: VELOCITY-630
> URL: https://issues.apache.org/jira/browse/VELOCITY-630
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5, 1.6-beta1
> Reporter: Byron Foster
> Attachments: Velocity630TestCase.java
>
>
> GIven the following:
> #macro(test $a $b)
> #foreach($i in $a) $b #end
> #end
> #test( [1, 2, 3] "#if($i == 2) yes #else no #end")
> I would expect the output:
> no yes no
> Instead, I get
> no no no
> The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org
[jira] Commented: (VELOCITY-630) Pass by name does not work with
#foreach within a macro
Posted by "Byron Foster (JIRA)" <de...@velocity.apache.org>.
[ https://issues.apache.org/jira/browse/VELOCITY-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639339#action_12639339 ]
Byron Foster commented on VELOCITY-630:
---------------------------------------
Yes, my feeling is that this is non-trivial, and is certainly a step softly kind of fix.
> Pass by name does not work with #foreach within a macro
> -------------------------------------------------------
>
> Key: VELOCITY-630
> URL: https://issues.apache.org/jira/browse/VELOCITY-630
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5, 1.6-beta1
> Reporter: Byron Foster
> Attachments: Velocity630TestCase.java
>
>
> GIven the following:
> #macro(test $a $b)
> #foreach($i in $a) $b #end
> #end
> #test( [1, 2, 3] "#if($i == 2) yes #else no #end")
> I would expect the output:
> no yes no
> Instead, I get
> no no no
> The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.
--
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: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org