https://kotlinlang.org logo
Title
r

reggar

08/04/2017, 4:18 PM
Is there any rationale behind Kotlin not being able to infer the type from the default value:
data class Foo(
        val bar = true
)
a

adambl4

08/04/2017, 4:56 PM
I think there are more rational than you can imagine. It’s better to ask “why”.
c

codeslubber

08/04/2017, 5:05 PM
I think the word he was looking for is rationale and that should not be offensive..
👍 3
j

janvladimirmostert

08/04/2017, 5:11 PM
I’ve been wondering about that as well, the rule as far as I know is that all params needs to be explicitly typed, not sure how easy it would be to relax that in the event that default values are given to a param.
👍 2