scala - Recommended style for arity-1 call followed by arity-0 call -


given official scala style guide
http://docs.scala-lang.org/style/method-invocation.html
recommends using infix notation arity-1 calls , dot notation arity-0 calls, what's recommended style arity-1 call followed arity-0 call?

for example, recommended way?

(bytes map (_.tochar)).mkstring 

the summary of style guide basically: use point-free style whenever simple , clear. otherwise, don't. in case, options are

bytes.map(_.tochar).mkstring (bytes map (_.tochar)).mkstring 

and former looks simpler , clearer me, wins.

really long chains not clear in point-free notation

foo bar baz qux quux bippy 

say again?

foo.bar(baz).qux(quux).bippy 

oh, okay.

be pragmatic. point-free style can clean , elegant. coding style lead write code looks nice point-free. point of syntax clear , avoid errors, use whichever better accomplishes goal.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -