unrelated `if (title == null) title = tmdbEpisode...
# language-proposals
z
unrelated
if (title == null) title = tmdbEpisode.name
I wish I could do
title ?= thing
. Like Ruby’s
||=
where it assigns only if not assigned yet. That could possibly mesh nicely with what I was raising here too: https://kotlinlang.slack.com/archives/C0B9K7EP2/p1527792590000151
v
To start the discussion: - How often do you have to use such code? Some numbers from github statistics maybe? - Can such code be abstracted away without modifying Koitlin? - Can using a null value be avoided altogether? - Will the proposed syntax be clear to people of all backgrounds? What other languages have similar constructs?
i
There's some discussion ongoing about the
?=
operator on the forum: https://discuss.kotlinlang.org/t/conditional-assignment-operator-proposal/8150
z
would it be best to keep to the discussion in that forum?
i
@Zac Sweers Yes, it won't vanish after reaching the message limit horizon in this slack.
z
🙂