Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: All

      Description

      A problem with recursing macros is that scopes are not nested
      when "velocimacro.context.localscope" is set to true. That is, a get() on a
      context does not percolate to a parent context if the get() returns null. This
      prevents accessing global variables in the context. The desired behavior
      (IMHO) would be for set()s to be local to the macro, and get()s to percolate up
      to the parent if not found.

        Activity

        Hide
        Geir Magnusson Jr added a comment -

        thx. ack

        actually, I think it doesn't have anything to do with recursion - you may
        have just noticed that in that context...

        Show
        Geir Magnusson Jr added a comment - thx. ack actually, I think it doesn't have anything to do with recursion - you may have just noticed that in that context...
        Hide
        Steven Hugg added a comment -

        Ya, it's not really related to recursion.

        Another thing.. given this behavior, there should also be a way to walk up the
        context stack inside of a nested macro so global vars. can be set. A
        getParentContext() and getTopmostContext() would be nice

        Show
        Steven Hugg added a comment - Ya, it's not really related to recursion. Another thing.. given this behavior, there should also be a way to walk up the context stack inside of a nested macro so global vars. can be set. A getParentContext() and getTopmostContext() would be nice
        Hide
        Will Glass-Husain added a comment -

        Seems easy enough to do. "The desired behavior (IMHO) would be for set()s to be local to the macro, and get()s to percolate up to the parent if not found." Suggest v1.6

        Show
        Will Glass-Husain added a comment - Seems easy enough to do. "The desired behavior (IMHO) would be for set()s to be local to the macro, and get()s to percolate up to the parent if not found." Suggest v1.6
        Hide
        Nathan Bubna added a comment -

        Simple test case to demonstrate the problem, for anyone interested.

        Show
        Nathan Bubna added a comment - Simple test case to demonstrate the problem, for anyone interested.
        Hide
        Nathan Bubna added a comment -

        Last night, before rev 691519, my test case for this was failing. This morning, it works. I can only assume that rev 691519 fixed it somehow, though i'm not sure how. Anyway, i can't figure a way to break/replicate this, so i'm calling it fixed.

        Show
        Nathan Bubna added a comment - Last night, before rev 691519, my test case for this was failing. This morning, it works. I can only assume that rev 691519 fixed it somehow, though i'm not sure how. Anyway, i can't figure a way to break/replicate this, so i'm calling it fixed.

          People

          • Assignee:
            Unassigned
            Reporter:
            Steven Hugg
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development