Why to use empty parentheses in Scala if we can just use no parentheses to define a function which does not need any arguments? -


as far understand, in scala can define function no parameters either using empty parentheses after name, or no parentheses @ all, , these 2 definitions not synonyms. purpose of distinguishing these 2 syntaxes , when should better use 1 instead of another?

it's question of convention. methods empty parameter lists are, convention, evaluated side-effects. methods without parameters assumed side-effect free. that's convention.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -