u/aabil11in r/scala • Recommends
Preferred style for Infix notation, for higher-order functions.
Scala allows "infix notation" where the dot and parenthesis can be left off of methods that take exactly 1 parameter. What is the preferred style for infix notation vs "." when it comes to chained higher order functions?
According to scala-lang.org, the preferred is infix notation:
`// wrong! names.map { _.toUpperCase }.filter { _.length > 5 }`
`// right! names map { _.toUpperCase } filter { _.length > 5 }`
However, according to the man himself, the preferred is ".method(...)" for chained operators.
Personally, I agree with Odersky here. I think using the dot notation actually makes things much more readable. Which do yo…