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

Claude Brisson commented on VELOCITY-904:
-----------------------------------------

Yes. It means that if {{$test.name}} is null in the global context, the macro 
will receive null as a value for the {{$name}} argument.

It means that you cannot rely on arguments being expressions of previous macro 
argument names.

With a little distance, you will concede that such constructs are really a bad 
practice: it means that the calling code uses names which are defined *inside* 
the macro. Binding the calling code to the inner macro names means that you 
wouldn't be able to rename macro arguments names without breaking calling code.


> Add a flag for better backward compatibility with null macro arguments
> ----------------------------------------------------------------------
>
>                 Key: VELOCITY-904
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-904
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 2.0
>            Reporter: Claude Brisson
>            Assignee: Claude Brisson
>            Priority: Minor
>             Fix For: 2.2
>
>
> See [this 
> comment|https://issues.apache.org/jira/browse/VELOCITY-542?focusedCommentId=16621819&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16621819]
>  :
> {code}
> #macro(testmacro $parameter)
>   $parameter
> #end
> #testmacro($return)
> {code}
> bq. which used to print "$return" (when $return is null or undefined) and we 
> now get "$parameter". 
>  



--
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

Reply via email to