Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.7-beta1
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Christopher Schultz added a comment -

        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.

        Show
        Christopher Schultz added a comment - 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.
        Hide
        Nathan Bubna added a comment -

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

        Show
        Nathan Bubna added a comment - #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.

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Osipov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development