You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Michael Osipov (JIRA)" <de...@velocity.apache.org> on 2010/08/26 15:38:55 UTC

[jira] Created: (VELOCITY-774) Provide #unset directive

Provide #unset directive
------------------------

                 Key: VELOCITY-774
                 URL: https://issues.apache.org/jira/browse/VELOCITY-774
             Project: Velocity
          Issue Type: New Feature
          Components: Engine
    Affects Versions: 1.7-beta1
            Reporter: Michael Osipov


Sometimes one wants to use a variable in a certain scope because the further existence might lead to errors. I declared var with #set should be unsettable. See VELOCITY-773 for a iuse case.

-- 
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-774) Provide #unset directive

Posted by "Christopher Schultz (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910872#action_12910872 ] 

Christopher Schultz commented on VELOCITY-774:
----------------------------------------------

You can also do

#set($foo = false)

...which I believe has the same effect. I use this at the bottom of loops all the time to make sure that I don't get in-loop variables bleeding-over one loop iteration into the next.

> Provide #unset directive
> ------------------------
>
>                 Key: VELOCITY-774
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-774
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 1.7-beta1
>            Reporter: Michael Osipov
>
> Sometimes one wants to use a variable in a certain scope because the further existence might lead to errors. I declared var with #set should be unsettable. See VELOCITY-773 for a iuse case.

-- 
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-774) Provide #unset directive

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-774.
-----------------------------------

    Resolution: Won't Fix

#set( $foo = $null )

or put your context into itself and do:

#set( $ignore = $!context.remove($foo) )

or in 1.7+ enable the particular explicit scope that you need:

macro.provide.scope.control = true

and then do:

$macro.foo = 'whatever'

and when the macro is gone, $macro.foo will be gone too.

> Provide #unset directive
> ------------------------
>
>                 Key: VELOCITY-774
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-774
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 1.7-beta1
>            Reporter: Michael Osipov
>
> Sometimes one wants to use a variable in a certain scope because the further existence might lead to errors. I declared var with #set should be unsettable. See VELOCITY-773 for a iuse case.

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