[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17023076#comment-17023076
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 8:00 AM:
---

Seems this had a side effect:

The following:

{code}
#macro (myMacro $myvar)
  $myvar
#end

#set ($myvar = "value")
#myMacro()
{code}

produces:

* Before VELOCITY-926 and in 1.7: "value"
* After VELOCITY-926: $myvar


was (Author: tmortagne):
Seems this had a side effect:

The following:

{code}
#macro (myMacro $myvar)
  $myvar
#end

#set ($myvar = "value")
#myMacro()
{code}

produces:

* Before VELOCITY-926 and in 1.7: "value"
* After VELOCITY-926: $foobar

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



Re: [ANNOUNCE] Velocity Engine 2.2 RC5 test build available

2020-01-27 Thread Claude Brisson
After a few PM with Greg, it became obvious that it's the same problem 
than with the missing arguments usecase listed in VELOCITY-926 comments.


See https://issues.apache.org/jira/browse/VELOCITY-926

My plan is to withdraw this RC to readdress #926.

On 20-01-26 12 h 46, Greg Huber wrote:

Hello,

Checking this, I have an error where it does not render a parameter
(generic variable) correctly ie $type:

#showAutocomplete("$search/entry", '1', $name, 'query', false)

#macro(showAutocomplete $sUrl $source $name $type $links)
...
data: {
   sUrl: "$sUrl",
   source: "$source",
   #if($name) name: "$name",#end
   $type: input.val()
 }


Expected:
sUrl: "/homepage/search/entry",
source: "1",
name: "homepage",
query: input.val()

Actual:
sUrl: "/homepage/search/entry",
source: "1",
name: "homepage",
$type: input.val()

$type is used extensively as a generic variable, so maybe there is some
clash somewhere?  Also if I rename the variable, for example $type1, it
seems to work.

I Also went back to 2.1 to check and it works as expected.

Cheers Greg

On Fri, 24 Jan 2020 at 11:21, Claude Brisson 
wrote:


The test build of Velocity Engine 2.2 RC5 is available.

No determination as to the quality ('alpha,' 'beta,' or 'GA') of
Velocity Engine 2.2 has been made, and at this time it is simply a "test
build". We welcome any comments you may have, and will take all feedback
into account if a quality vote is called for this build.

Release notes:

*

https://dist.apache.org/repos/dist/dev/velocity/velocity-engine/2.2/release-notes.html


Distribution:

   * https://dist.apache.org/repos/dist/dev/velocity/velocity-engine/2.2/

Maven 2 staging repository:

   *
https://repository.apache.org/content/repositories/orgapachevelocity-1033/

Documentation:

* https://velocity.apache.org/engine/2.2/

Sources:

   * https://svn.apache.org/repos/asf/velocity/engine/tags/2.2/

Release Candidates History:

   * RC1 Initial RC

   * RC2
   - added BigInteger and BigDecimal implicit conversions
   - [VELOCITY-923] fixed a parser regression for `$foo||`
   - [VELOCITY-904] fixed two corner case bugs for the
velocimacro.arguments.preserve_literals backward compatibility flag
   - fixed engine and dependency versions in README and mention the
parser customization feature in the *building* section
   - nicified README links
   - upgraded surfire plugin version from 2.19.1 to 2.22.1
   - upgraded maven-jar-plugin from 3.1.1 to 3.2.2
   - added version 1.2 for extra-enforcer-rules
   - upgraded maven-javadoc-plugin from 3.1.0 to 3.1.1
   - upgraded findbugs-maven-plugin from 3.0.4 to 3.0.5
   - upgraded maven-release-plugin from *unspecified* to 3.0.0-M1
   - added a new templatized static class
org.apache.velocity.runtime.VelocityEngineVersion.java
   - use the File Separator control character to mark the end of stream
for the parser (instead of the zero-width space char)
   - reviewed packaging of engine examples (refreshed content, plus made
them as a standalone zip file with readme, shell scripts, dependencies
and examples sources rather than a meaningless standalone pom next to a
jar without explanations...)

* RC3
   - [VELOCITY-904] fixed yet another corner case bugs for the
velocimacro.arguments.preserve_literals backward compatibility flag
   - upgraded SLF4J from 1.7.28 to 1.7.30

* RC4
   - [VELOCITY-904] fixed a regression introduced in RC3

* RC5
   - [VELOCITY-924] fixed cache collision between an object and its class
   - Javadoc fixes in parser genereted classes
   - [VELOCITY-925] fixed BC whitespace gobbling for macro call without
parentheses
   - [VELOCITY-926] fixed regression: Macro arguments names cannot
collide with external references names
   - upgraded junit from 4.12 to 4.13



-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org




-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Reopened] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Claude Brisson (Jira)


 [ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Brisson reopened VELOCITY-926:
-

When a naming collision occurs, there is a side effect which is that in 1.7, 
global context values become default values for *missing* macro arguments.

Two people reported usecases where backward compatibility was broken because of 
this 1.7 _undocumented feature_, so it's worth addressing.

The plan is to deprecate the 2.1 flag 
{{velocimacro.arguments.preserve_literals}} in favor of a new 
{{velocimacro.enable_bc_mode}} flag which would :

* preserve arguments literals
* allow global values as defaults for missing arguments
* also allow a macro to set to null a reference in the global context by 
setting one of its arguments to null (setting a global reference this way is 
allowed in 2.x but not for null values)






> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Claude Brisson (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024549#comment-17024549
 ] 

Claude Brisson edited comment on VELOCITY-926 at 1/28/20 6:40 AM:
--

When a naming collision occurs, there is a side effect which is that in 1.7, 
global context values become default values for *missing* macro arguments.

Two people reported usecases where backward compatibility was broken because of 
this 1.7 _undocumented feature_, so it's worth addressing.

The plan is to deprecate the 2.1 flag 
{{velocimacro.arguments.preserve_literals}} in favor of a new 
{{velocimacro.enable_bc_mode}} flag which would :
 * preserve arguments literals
 * allow global values as defaults for missing arguments
 * -also allow a macro to set to null a reference in the global context by 
setting one of its arguments to null (setting a global reference this way is 
allowed in 2.x but not for null values)- (let's leave out this one and revert 
the _standard_ behavior to also allow setting nulls by default, it was just a 
side effect of fixing VELOCITY-904 with commit 1871332)
 



was (Author: claude):
When a naming collision occurs, there is a side effect which is that in 1.7, 
global context values become default values for *missing* macro arguments.

Two people reported usecases where backward compatibility was broken because of 
this 1.7 _undocumented feature_, so it's worth addressing.

The plan is to deprecate the 2.1 flag 
{{velocimacro.arguments.preserve_literals}} in favor of a new 
{{velocimacro.enable_bc_mode}} flag which would :

* preserve arguments literals
* allow global values as defaults for missing arguments
* also allow a macro to set to null a reference in the global context by 
setting one of its arguments to null (setting a global reference this way is 
allowed in 2.x but not for null values)






> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024437#comment-17024437
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 3:39 PM:
---

bq. global values provide defaults for missing arguments

Sounds good to me. It would be enough to cover 
https://issues.apache.org/jira/browse/VELOCITY-926?focusedCommentId=17023076=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17023076.

Even if it does not cover the other use cases discussed on the mailing list 
regarding the macro local context it's still  better than nothing.


was (Author: tmortagne):
bq. global values provide defaults for missing arguments

Sounds good to me. It would be enough to cover 
https://issues.apache.org/jira/browse/VELOCITY-926?focusedCommentId=17023076=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17023076.

Even if it does not cover the other use cases discussed on the mailing list 
regarding the macro local context it's better still  better than nothing.

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024437#comment-17024437
 ] 

Thomas Mortagne commented on VELOCITY-926:
--

bq. global values provide defaults for missing arguments

Sounds good to me. It would be enough to cover 
https://issues.apache.org/jira/browse/VELOCITY-926?focusedCommentId=17023076=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17023076.

Even if it does not cover the other use cases discussed on the mailing list 
regarding the macro local context it's better still  better than nothing.

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024437#comment-17024437
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 3:47 PM:
---

bq. global values provide defaults for missing arguments

Sounds good to me. It would be enough to cover 
https://issues.apache.org/jira/browse/VELOCITY-926?focusedCommentId=17023076=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17023076.

Even if it does not cover the other use cases discussed on the mailing list 
regarding the macro local context it's still  better than nothing (at least we 
can say "hey it's Velocity's fault, we tried" and have a good excuse to have a 
simpler behavior ;)).


was (Author: tmortagne):
bq. global values provide defaults for missing arguments

Sounds good to me. It would be enough to cover 
https://issues.apache.org/jira/browse/VELOCITY-926?focusedCommentId=17023076=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17023076.

Even if it does not cover the other use cases discussed on the mailing list 
regarding the macro local context it's still  better than nothing.

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024342#comment-17024342
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 1:39 PM:
---

bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :) From what I understand the reason for this 
behavior in 1.7 is a side effect of the local macro context (the macro 
parameter being unset in the local context but variables were also fallbacking 
to global context when unset) which does not exist anymore and I guess it not 
really easy to get back this behavior without getting back the local macro 
context which you said you did not wanted anymore even as a retro compatible 
option.


was (Author: tmortagne):
bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :) From what I understand the reason for this 
behavior in 1.7 is a side effect of the local macro context which does not 
exist anymore and I guess it not really easy to get back this behavior without 
getting back the local macro context which you said you did not wanted anymore 
even as a retro compatible option.

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024342#comment-17024342
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 1:46 PM:
---

bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :) From what I understand the reason for this 
behavior in 1.7 is a side effect of the local macro context (the macro 
parameter being null the local context but variables were also fallbacking to 
global context when unset) which does not exist anymore and I guess it not 
really easy to get back this behavior without getting back the local macro 
context which you said you did not wanted anymore even as a retro compatible 
option.


was (Author: tmortagne):
bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :) From what I understand the reason for this 
behavior in 1.7 is a side effect of the local macro context (the macro 
parameter being unset in the local context but variables were also fallbacking 
to global context when unset) which does not exist anymore and I guess it not 
really easy to get back this behavior without getting back the local macro 
context which you said you did not wanted anymore even as a retro compatible 
option.

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024342#comment-17024342
 ] 

Thomas Mortagne commented on VELOCITY-926:
--

bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :)

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Comment Edited] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Thomas Mortagne (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024342#comment-17024342
 ] 

Thomas Mortagne edited comment on VELOCITY-926 at 1/27/20 1:38 PM:
---

bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :) From what I understand the reason for this 
behavior in 1.7 is a side effect of the local macro context which does not 
exist anymore and I guess it not really easy to get back this behavior without 
getting back the local macro context which you said you did not wanted anymore 
even as a retro compatible option.


was (Author: tmortagne):
bq. That's why I was asking for a specific use case

What I can tell you is that we did fixed several codes in XWiki Standard doing 
that but I agree with you that it was mistakes in both cases. So yes I don't 
have a strong use case to describe but any weird behavior always end up being 
expected and used in 10 years :)

> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-926) Regression: Macro arguments names cannot collide with external references names

2020-01-27 Thread Claude Brisson (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024414#comment-17024414
 ] 

Claude Brisson commented on VELOCITY-926:
-

What I'm ready to do is review the compatibility option(s) so that global 
values provide defaults for missing arguments. It looks like you are not the 
only ones hitting this problem, as Greg Huber reported a similar one. That 
should fix the recently found differences. I don't know yet if it will be a new 
{{velocimacro.arguments.global_defaults}} or if it is preferable to deprecate 
{{velocimacro.arguments.preserve_literals}} and gather both BC behaviors in a 
new {{velocimacro_enable_bc_mode}} flag. The later has the advantage that it 
can incorporate other adjustments, like a macro being able to set to null a 
global reference by setting to null an argument with the same name.

What is certain is that reinserting the ProxyVMContext is to be avoided. It had 
been identified as a major performance bottleneck, and removed for a reason. So 
beyond the behaviors that won't be emulated is the usecase where you expect a 
macro to keep its locally set values even if they are modified by external 
macros or parsings.




> Regression: Macro arguments names cannot collide with external references 
> names
> ---
>
> Key: VELOCITY-926
> URL: https://issues.apache.org/jira/browse/VELOCITY-926
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.0, 2.1
>Reporter: Claude Brisson
>Assignee: Claude Brisson
>Priority: Major
> Fix For: 2.2
>
>
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org