elect
12/15/2021, 2:24 PMit0, it1,..
Emil Kantis
12/15/2021, 2:25 PMfirst, second
🙂elect
12/15/2021, 2:27 PMJoffrey
12/15/2021, 2:29 PMit
is nice for a single argument because it reads like english:
map { it.toSomething() }
takeIf { it.isNotEmpty() }
Using it0
, it1
etc. would not be as niceelect
12/15/2021, 2:32 PMJoffrey
12/15/2021, 2:39 PMelect
12/15/2021, 2:40 PMJoffrey
12/15/2021, 2:49 PM{ x0, x1, x2 -> // use x0, x1, x2 }
is that terrible compared to { // use it0, it1, it3 }
. So I'm wondering whether it would be worth it.
Misuse is just one part of the "cost" of that feature, and I agree it's not a sufficiently valid argument to rule something out.elect
12/15/2021, 2:52 PMRoukanken
12/15/2021, 3:12 PMelect
12/15/2021, 5:01 PMRoukanken
12/15/2021, 5:04 PMelect
12/15/2021, 5:10 PMephemient
12/15/2021, 7:06 PM$0
, $1
, etc. parameters in its closures, but it rarely has overloads by the same name, which is reinforced by requiring named parameters almost everywhereelect
12/15/2021, 7:09 PMephemient
12/15/2021, 7:11 PMjimn
12/17/2021, 10:34 PM$0, $1
and has opened a lot of doors as a C-like shell. kotlin is like c-shell for java so we can just use ... wait...louiscad
01/04/2022, 2:26 AMI'm always for teaching good practices rather than forbidding new features for a potential abuse
That's probably how guns came to be, and came to not always be used for the right thing. This philosophy works for some people, but never works for everyone, mostly because many folks skip the learning phase, aka doc/feedback reading.
ephemient
01/04/2022, 2:44 AM