Brackets for fuzzy functions

I know that I should use () by convention if a method has side effects

def method1(a: String): Unit = {
  //.....
}

//or

def method2(): Unit = {
  //.....
}

Should I do the same if the method has no side effects, but it is not clean, does not have any parameters and, of course, it returns different results each time it is called?

def method3() = getRemoteSessionId("login", "password")
+4
source share
2 answers

Edit: After reviewing Luigi Plinge's comment, I came to the conclusion that I should rewrite the answer. This is also not a clear yes / no answer, but some suggestions.


-: var . a var foo getter foo . , , ( ).

-, : , getRemoteSessionId , , - , . method3() - .

: file.children, file.children(), , (, , ).

: , System.currentTimeMillis. System.currentTimeMillis()...

, : , ; , .

, getRemoteSessionId . , file.children()...

+1

Scala :

, ( , ), , , .

, . , , , , , , () .

+1

All Articles