5 ms·
This is a killer "app" for Java 21. There's now little reason to choose Kotlin or some other language to build efficient API's etc.
by sgt 3y ago
This is a killer "app" for Java 21. There's now little reason to choose Kotlin or some other language to build efficient API's etc.
- jfengel 3y agoWas there ever? What made Kotlin fundamentally different in that respect? Kotlin is great for fixing some legacy design oopsies (Java really should have been smarter about null and it can't be fixed without breaking legacy code), but I wouldn't expect it to do something that was impossible or it infeasible in Java.
- Tainnor 3y agoCoroutines are one of the most prominent features of Kotlin, so it does make sense to bring this up in the discussion. OTOH, I'm unconvinced that virtual threads make coroutines, reactive APIs etc. obsolete. Those are about structured concurrency, and with projet Loom, the structured concurrency proposal is still in the incubating stage.
- mikmoila 3y agoSC will be a preview level API in Java 21: https://openjdk.org/jeps/453 https://openjdk.org/jeps/453
- richbell 3y agoThe magic of Kotlin's structured concurrency is that it "just works" without you having to think about it, and it's difficult to screw up. This looks a fair bit more involved, though I'm excited for it nonetheless.
- zmmmmm 3y agoYes from a pure functional perspective, it's really down to null handling at this point. But kotlin has a lot of nice syntactic sugar still. Same with Groovy.
- Tainnor 3y ago> it's really down to null handling at this point. and reified generics, if you care about that sort of thing. Plus immutability/final by default, the stdlib being a joy to use, etc.
- pjmlp 3y agoWe all know how Groovy ended. Being syntax sugar isn't enough to keep a language going.
- brabel 3y agoWhat do you mean, how Groovy ended? It's still going strong with regular releases and continues to keep up with new Java features! It's a pretty nice language if you don't mind dynamic typing, which has its uses.
- pjmlp 3y agoNo one cares it exists, beyond Gradle scripts, Gradle saved the language to join fate with Beanshell, jTcl, jython,.... Long are the days where it was proposed to have parity alongside Java in Java EE, and Spring used to talk about it as it does with Kotlin nowadays. Or when Grails was a common subject of talk proposals at German JUG meetings.
- brabel 3y agoWell I care a lot that it exists. And many other people I know do as well. Just because you don't seem to like it, you shouldn't imagine everyone else is like you. Maybe Grails is no longer used as much (like Rails itself), but Groovy found other usages since then, like https://spockframework.org/ https://spockframework.org/ and Jenkins pipelines (https://www.jenkins.io/doc/book/pipeline/syntax/ https://www.jenkins.io/doc/book/pipeline/syntax/). It's not going anywhere, and I see no reason for anyone to be upset about it.
- pjmlp 3y ago
- 4RealFreedom 3y agoI write both Kotlin and Java but Kotlin is my go to. Kotlin's when statements alone are a reason to use it. Then there's the null safety, extension functions, built in lazy initialization, and smart casts. Kotlin is just a joy to write in.
- paulddraper 3y agoPlus...Kotlin is compatible with Java, so even a small improvement can still be reason enough to use it
- sgt 3y agoGood point. But getting Java devs (ie the rest of my team) to join in on the Kotlin fun has proven difficult.