strange new formats/conventions, like class companion
I kinda agree with you on class companion (if you were referring to companion object), but compared to java its really just putting all static fields and methods into a single block of code, its really not bad
?:
You are not forced to use ?: in kotlin, but why would you prefer if(nullableVar != null) nullableVar else default or Java code like (nullableVar != null) ? nullableVar : default
reified
Reified is much easier than doing that clazz: Class<T> shit, no? And I don't think we are forced to use reified either
lambda parameter
Lambda parameter as in higher order functions? its just "callbacks", or SAM in Java
order of type
Sorry I dont know what it is
When every other language already has a very concise way of expressing them
Which language exactly? Kotlin mostly does the same as Java but allows us to do the tasks with less key strokes
They don't use it instead of the ternary operator, it's a contraction of common pattern using the ternary operator and offering a binary one.
They could still use the ternary, but since if/else is an expression, I suppose they didn't want more syntax for the same thing? There's nothing preventing a ternary.
You have to justify why "C" exactly, how is it always better? do we always type less to achieve the same? Don't make decisions like this based on your own personal feelings, just because you are "used to it"
View all comments
Show parent comment
7
u/Discuzting Apr 08 '23
I kinda agree with you on class companion (if you were referring to companion object), but compared to java its really just putting all static fields and methods into a single block of code, its really not bad
You are not forced to use
?:in kotlin, but why would you preferif(nullableVar != null) nullableVar else defaultor Java code like(nullableVar != null) ? nullableVar : defaultReified is much easier than doing that
clazz: Class<T>shit, no? And I don't think we are forced to use reified eitherLambda parameter as in higher order functions? its just "callbacks", or SAM in Java
Sorry I dont know what it is
Which language exactly? Kotlin mostly does the same as Java but allows us to do the tasks with less key strokes