Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7935

Right side of assignment - remove parens or not?

    XMLWordPrintableJSON

Details

    Description

      The Groovy style guide says, "... Groovy doesn’t allow you to remove parentheses. [...] for nested method calls or on the right-hand side of an assignment, you can’t omit them there."

      Then, a code fragment is given, where just this works.

      def foo(n) { n }
      
      println foo 1 // won't work, as documented
      def m = foo 1 // this works indeed!
      

      Further more, I could not find any examples, where this would not work, neither with comma separated parameter lists nor with infix computations nor closures.

      So I guess it is just a documentation bug and right-hand side parens removal support has been added.

      Attachments

        Activity

          People

            jwagenleitner John Wagenleitner
            tinne tinne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: