gabrielfv
07/26/2017, 10:33 PMval something = someExpr()
get() = someOtherExpr()
class Foo {
var bar = 2
get() {
tar *= 4
return tar
}
var tar = 3
}
diesieben07
07/26/2017, 10:49 PMcedric
07/28/2017, 12:22 PM=
, I just don't understand the point in having two ways to declare functionsgabrielfv
07/28/2017, 8:05 PMgabrielfv
07/28/2017, 8:09 PMint sum(int a, int b) { return a + b; }
That's not something I'd like to see, particularly, and now there's no excuse if such thing appears when you could just
fun sum(a: Int, b: Int) = a + b
gabrielfv
07/28/2017, 8:09 PMcedric
07/28/2017, 8:13 PMint sum(int a, int b) { return a + b; }
has the merit of being consistent and not offering two ways to do the same thingcedric
07/28/2017, 8:14 PMint sum() = ...
is inconsistent (and on a personal level, it's weird to see () =
)gabrielfv
07/29/2017, 5:58 PMgabrielfv
07/29/2017, 6:01 PMval sum = { a: Int, b: Int -> a + b }
cedric
07/29/2017, 6:02 PM