groovy
  1. groovy
  2. GROOVY-1543

Support multiple declarations at once: def a,b = 1,2

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6-beta-2
    • Component/s: syntax
    • Labels:
      None
    • Number of attachments :
      0

      Description

      We should support multiple declarations at once:

      def a, b = 1,2

      Or more advanced

      def a, b = [1,2,3], [4,5,6]

        Issue Links

          Activity

          Hide
          Paul King added a comment -

          Some overlap with GROOVY-158 but not quite the same - leaving both open for now.

          Show
          Paul King added a comment - Some overlap with GROOVY-158 but not quite the same - leaving both open for now.
          Hide
          blackdrag blackdrag added a comment -

          should work now

          Show
          blackdrag blackdrag added a comment - should work now
          Hide
          Paul King added a comment -

          Isn't that the difference between GROOVY-158 and this issue?

          Currently we allow:

          def a, b
          [a, b] = [[1,2,3], [4,5,6]]
          

          but this issue wants:

          def [a, b] = [[1,2,3], [4,5,6]]
          

          which we don't allow?

          Show
          Paul King added a comment - Isn't that the difference between GROOVY-158 and this issue? Currently we allow: def a, b [a, b] = [[1,2,3], [4,5,6]] but this issue wants: def [a, b] = [[1,2,3], [4,5,6]] which we don't allow?
          Hide
          blackdrag blackdrag added a comment -

          ah, ok, didn't see that

          Show
          blackdrag blackdrag added a comment - ah, ok, didn't see that
          Hide
          blackdrag blackdrag added a comment -

          but I doubt we can have this in 1.6

          Show
          blackdrag blackdrag added a comment - but I doubt we can have this in 1.6
          Hide
          blackdrag blackdrag added a comment -

          it is now

          def (a,b) = [[1,2],[3,4]]

          and

          (a,b) = [1,2]

          Show
          blackdrag blackdrag added a comment - it is now def (a,b) = [ [1,2] , [3,4] ] and (a,b) = [1,2]

            People

            • Assignee:
              blackdrag blackdrag
              Reporter:
              Graeme Rocher
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: