Best practice: Parameterless function; with or without parentheses?

I skimmed through the Scala coding convention and read, that parameterless functions should be declared without parentheses if they do not cause any side-effect.

In my understanding, this would mean, that only “pure” functions should be notated without parentheses. But this leads to my confusion: What’s the point in a pure function without parameter? And therefore I believe that I interpret “no side-effect” wrongly.

What’s your take on that?

1 Like

The point of a pure function is that it’s only evaluated if it has to.

length on List is an example.