Scala: Standard style of using parentheses when calling procedures

As a brief note to self, when calling procedures in Scala, the Scala Style Guide suggests the following:

  1. If the procedure is basically just an accessor, leave the parentheses off
  2. If the procedure has some sort of side-effect, use the parentheses

These examples demonstrate the preferred procedure style:

val name = person.name   // a procedure that works like an accessor
openTheGarageDoors()     // a procedure that has a side-effect

Also note that to enforce this standard you need to define methods like openTheGarageDoors with parentheses when you declare it:

def openTheGarageDoors() = ...

You can find more details about this on the Scala Style Guide here in the “parentheses” section and and here in the “Arity-0” section. As they state in the second link:

“Religiously observing this convention will dramatically improve code readability and will make it much easier to understand at a glance the most basic operation of any given method. Resist the urge to omit parentheses simply to save two characters!”