https://kotlinlang.org logo
Title
e

Egor Trutenko

10/09/2018, 10:47 AM
Um, just a general opinion question: does Kotlin really need ternary operator?
🇳🇴 27
:yes: 6
g

gildor

10/09/2018, 10:50 AM
If you want to read more opinions, check this discussion https://discuss.kotlinlang.org/t/ternary-operator/2116
e

Egor Trutenko

10/09/2018, 10:52 AM
Thanks, tho I wanted a bit more fresh opinions
g

gildor

10/09/2018, 10:52 AM
Do you think arguments changed some how? %)
e

Egor Trutenko

10/09/2018, 10:52 AM
Fair point :^)
g

gildor

10/09/2018, 10:53 AM
I use Kotlin for about 2.5 years and never want to have ternary operator, especially now
In 90% of cases people use it in Java to check for
null
e

Egor Trutenko

10/09/2018, 10:54 AM
Yeah, me neither. It's just that there's a hot discussion was set off in russian tg chat, so I referred to another source of opinions
g

gildor

10/09/2018, 10:55 AM
I think mostly it’s just nagging of newcomers rather than real need to have ternary operator in the language
h

hudsonb

10/09/2018, 11:34 AM
need? no. Would I like to have it? Yes
1
g

gildor

10/09/2018, 11:35 AM
This is actually a really good reason do not introduce a new language feature
4
d

diego-gomez-olvera

10/09/2018, 12:29 PM
IMHO the lack of ternary operation is pretty good, as it pushes Java developers to use
if
as an expression, driving them from mutability/statements thinking to immutability/expressions, which generally lead to more robust software
👏 2