Should a `?:` be evaluated on an argument of an in...
# language-proposals
r
Should a
?:
be evaluated on an argument of an infix function call, or on the call's result? From general:
Copy code
>>> val m = mutableMapOf<String, String>()
>>> "a" to m["b"] ?: "was null"
(a, null)
>>> "a" to (m["b"] ?: "was null")
(a, was null)
I wasn't expecting the first result. Perhaps I should have but it seemed obvious to me that the
?: "was null"
would be applied to
m["b"]
and not
"a" to m["b"]
. The response on #general was that the first result was obvious, but is it?