Hacker News new | past | comments | ask | show | jobs | submit login

1. Language problem:

    if (this.prop != null) {
        this.prop.something() // does not work
    }
this construction works for local variables, but not for properties. Yeah, theoretically it could be modified by another thread or function in the middle. In practice it does not happen and I'm forced to use terrible code like

    this.prop?.apply { prop ->
        prop.something()
    }
(this example could be written as this.prop?.something() but that's not the point, usually it's harder than that.

2. Interoperation problem. A lot of Java code does not use @Nullable annotations, so all types are just that: platform types. So Kotlin nullability adds nothing to that.




What is uglier about the kotlin code? It's the same number of lines and the code is more robust. What's the ugly part?


Using library functions instead of language keywords feels very wrong to me.


Why?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: