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

Nathan Bubna commented on VELOCITY-619:
---------------------------------------

Not being able to use #if like that in strict mode might confuse people too.  I 
actually didn't fully realize/notice that the patch for VELOCITY-618 would make 
#if( $foo ) throw an error in strict mode.  i use #if to check if a variable is 
present as often as i use it to check if a variable is true or false.

My preference would be to allow #if( $foo ) even in strict mode.  Then this 
behaviour is possible without introducing any backwards compatibility concerns. 
   We can re-examine this if/when someone gets a 2.0 version started.  Then 
backwards compatibility is not much of a concern.

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

Reply via email to