1. 7

  2. 2

    There seemed to be a distinct lack of a “fireside” in this chat.

    1. 1

      Interestingly, the scala style guide goes directly against this, saying that only functions without side effects should be invoked without parentheses. In scala, parentheses are not required for method chaining.

      1. 0

        This fireside chat only address method that take arguments but not getters. In scala’s case, you can only choose to not use parentheses for getters and operators. Since the point of getters is to look and act like an attribute, it seems like both the scala style and the OP would agree that nto including parentheses is ok.

        1. 3

          I think you are mistaken. Scala doesn’t have the concept of operators distinct of methods, and getters are not the only case in which you can use infix operators. If you look at the examples in the scala style guide that I linked to, none of them is a getter except maybe getOrElse. For example, List(3, 6, 12) map (_ * 2) is valid scala, but is not a getter.

          edit: I was thinking of this semantically as being about infix operators, so my example actually has parentheses. A similar example which does not have parentheses is List(“one”, “two”, “three”) map println

      2. 1

        So, omit parens when calling ‘puts’? See how long that lasts.

        My preference is to omit parens whenever possible. Use them for required grouping.

        If you need parens to signal what code is doing you’re doing it wrong.

        Btw, haskell is quite a mathy hardcore functional language so the notion of parens meaning some mathy function thing is simply anecdotal bias.

        For what it’s worth I’ve yet to see a clear and consitent argument for including parens when not required by the language. There always seems to be ad hoc exceptions based on aethetics.