bsimmons
07/27/2020, 12:46 PM// Why is it that we are encouraged to add spaces before EVERY lambda?
// Seems to me like the spaces arbitrarily break up this expression.
list.filter { it < 10 }.map { it * it }
// This is the long-form syntax, right?
list.filter({ it < 10 }).map({ it * it })
// So after a little syntactic sugar, we should end up like this?
list.filter{ it < 10 }.map{ it * it }
Tobias Berger
07/27/2020, 1:05 PMbsimmons
07/27/2020, 1:16 PMKroppeb
07/27/2020, 1:49 PMMilan Hruban
07/27/2020, 2:09 PM{
just seems weird to mebsimmons
07/27/2020, 2:14 PMlist.filter
example are obtrusive?Milan Hruban
07/27/2020, 2:38 PM{
is part of the filter
word, and the rest just stands there alone
list.filter{ it < 10 }
.map{ it * it }
bsimmons
07/27/2020, 3:51 PM{
and filter
because it's like a direct argument of it.
(I guess it was only just a few weeks ago that I disliked the primary constructor being slapped in the middle of a class declaration, but now I've come to enjoy it.)Milan Hruban
07/27/2020, 4:26 PMbsimmons
07/27/2020, 4:45 PMelizarov
07/28/2020, 12:47 PMclass Foo { … }
, synchonized { … }
, do { … } while
, etc it is very natural to put a space before an opening curly brace.bsimmons
07/28/2020, 1:45 PMlist.filter
case is just a minor edge case relative to the most common uses of curly braces.Tobias Berger
07/28/2020, 1:46 PMbsimmons
07/28/2020, 1:48 PMbsimmons
07/28/2020, 1:49 PMTobias Berger
07/28/2020, 1:50 PMbsimmons
07/28/2020, 2:09 PM