News for hackers. Stuff that matters.
Re:Magic is often used to describe confusing code by JackFr on Friday March 25, 2016 @09:16PM (#11363925)
WRT pragmatism, why

    val transformedCollection = collection map transformer
instead of

    val transformedCollection = collection.map(transformer)

?
Re:Magic is often used to describe confusing code by 0xfaded on Friday March 25, 2016 @09:29PM (#11363981)
The scala style guide suggests that the dotless notation be used for pure (side-effect-less) operations.
Re:Magic is often used to describe confusing code by hibikir on Friday March 25, 2016 @09:41PM (#11364035)
If there is a language where the style guide is rarely followed, it's Scala.

The dotless notation gets complicated easily the moment you try to extend it past one function call, as you start counting to figure out the order of operations. In fact, even using the shortcut of just using a function name instead of {x=> f(x)} or f(_) is seen as bad form in plenty of places, as knowing if a function has zero parameters, one m ten, or if it's varargs is very important information.

I'd limit dotless to very few cases, like symbolic operators, and very organic DSLs, and even then, it doesn't really work all the time: Just look at ScalaTest: Even Bill's wizardry doesn't let us say that "x should be 2": We have to write "x should be(2)", or "x shouldBe 2".

If it wasn't for symbolic operators, which are useful in some cases, I'd go as far as to not miss the existence of the feature at all.

Re:Magic is often used to describe confusing code by 0xfaded on Friday March 25, 2016 @11:29PM (#11364303)
Agreed the style guide is a guideline at best.

I've moved to the dotless notation because I like that it provides a way to indicate pure code. Postfix operators are poorly supported though.

  (xs map { x => x.key -> x }).toMap
Re:Magic is often used to describe confusing code by J_Darnley on Friday March 25, 2016 @09:36PM (#11364009)
If learning Lua has taught me one thing it is that I hate function calls without parentheses.
Re:Magic is often used to describe confusing code by bjz_ on Friday March 25, 2016 @10:47PM (#11364223)
Same with Ruby. So hard to understand what is going on - and unlike Scala there is not even any and typechecking to help.