I just noticed ECMAScript 2021 added exactly this ...
# language-proposals
e
I just noticed ECMAScript 2021 added exactly this with their "logical nullish assignment"
??=
operator. You can read about it here on MDN. Based on this I'd like to restart discussion of the idea for Kotlin. It would function pretty much exactly as the MDN page describes.
👎 1
👎🏻 1
m
I very rarely write
if (x == null) x = y
, so I don’t see the need to add a special syntax for that.
2
j
x=x?:y
is one more character
1
K 1
👏 1