Idk if this is the right session, but what you guy...
# codingconventions
g
Idk if this is the right session, but what you guys think about nullable parameters defaulting to null?
fun foo(bar: Int?)
can be called like
foo()
, instead of having to write
fun foo(bar: Int? = null)
. I see people comonly reading the
?
as sort of "opitional" in this context, and I don't see the point of calling
foo(null)
, though makes some sense when
Copy code
val a: Int? = mayReturnInt()
foo(a)
Is a common scenario
g
Or some reasonable default value for Int, like
fun foo(bar: Int = 0)
y
if you want to propose a language change, that would be in #language-proposals, but I find it unlikely that we would accept this. explicit is better than implicit in this area.
👍 2
g
Thanks. I'll post there anyways, as I think it may be a valid discussion.