Comment on Scala, Part IIparentComments−mcv7yOnly one? If there's any justice in the world, it's the only one without any brackets. I fear it's one of the many without a dot, though.−rgoulter7yThis all depends which syntactic conventions you're used to."a + b" is more readable than "a.+(b)", and so that's what scala allows. I think it's a neat way of allowing operator overloading."iterable.foreach { ... }" is also readable for a callback.FWIW, the one which doesn't compile is (apparently) "seq.foreach(x: Int => println(x))". https://scastie.scala-lang.org/krtG0VwgTmCNwIxATYFAbg
Comments
Only one? If there's any justice in the world, it's the only one without any brackets. I fear it's one of the many without a dot, though.
This all depends which syntactic conventions you're used to.
"a + b" is more readable than "a.+(b)", and so that's what scala allows. I think it's a neat way of allowing operator overloading.
"iterable.foreach { ... }" is also readable for a callback.
FWIW, the one which doesn't compile is (apparently) "seq.foreach(x: Int => println(x))". https://scastie.scala-lang.org/krtG0VwgTmCNwIxATYFAbg