https://kotlinlang.org logo
Title
k

karelpeeters

04/08/2019, 4:02 PM
It doesn't?
x?.toString()
can return
null
,
x.toString where x:Any?
will return
"null"
instead.
r

Ruckus

04/08/2019, 4:06 PM
You misunderstood. There is a defined
fun Any?.toString(): String
in the standard library
k

karelpeeters

04/08/2019, 4:07 PM
Yes, that's my second example.
r

Ruckus

04/08/2019, 4:08 PM
Yes, and @Dias was referring to the definition
Any?.toString()
, not to the call
x?.toString()
k

karelpeeters

04/08/2019, 4:08 PM
Hmm, I guess I see what he means. I meant the
?.
at the callsite 😒imple_smile:
r

Ruckus

04/08/2019, 4:09 PM
Indeed. I think this distinction between definition and call site is more confusing than the returned value 🙂
k

karelpeeters

04/08/2019, 4:14 PM
Agreed!