[ https://issues.apache.org/jira/browse/VELOCITY-619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636300#action_12636300 ]
Christoph Reck commented on VELOCITY-619: ----------------------------------------- True that if someone used #set( $!foo = $bar ) in an earlier version it set the value ignoring the bang. At some point it was discussed to use this syntax to explicetely allow setting a NULL value. Changing this would break BC (even though it is an unimplemented feature - some people may have local patches to do so - as I had once...). I propose to add a new directive for this, instead of overloading the #set with bang to mean "set only if undefined". Possible directive names: #default, #option, #setUndefined, #setIfUndefined, #allow, #let P.S. This is inline with some new directives introduced in Vel1.6: #evaluate, #define($ref)...#end, and #break > New set modifier so that set only assigns a value when variable is not > defined. > ------------------------------------------------------------------------------- > > Key: VELOCITY-619 > URL: https://issues.apache.org/jira/browse/VELOCITY-619 > Project: Velocity > Issue Type: Improvement > Components: Engine > Reporter: Byron Foster > Attachments: setBangModifier_2.patch > > > Define a new #set modifier such that a variable is only set if it is not > defined, like so: > #set($!foo = "bar") > If the '!' character proceeds the variable foo, then $foo will be set with > the value of "bar" ONLY IF $foo is not defined (is not in the context). > Otherwise if $foo is defined it will remain unchanged. -- 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]