5 ms·
Apart from legacy projects written in Kotlin, after Java 21/23, what's the argument for using Kotlin anymore, especially that it's a proprietary language?
by twen_ty 1y ago
Apart from legacy projects written in Kotlin, after Java 21/23, what's the argument for using Kotlin anymore, especially that it's a proprietary language?
- pjmlp 1y agoHaving to target Android, Google's .NET, mostly.
- cosmic_cheese 1y agoYep. Not sure I’d use it elsewhere, but it’s the best option for Android dev at the moment.
- thuridas 1y ago- It has the best null handling mechanism - Java handling of mutability of variables and collections - Java is still more verbose and with less powerful utilities - Much better for functional programming -Some things were done right with all the learnt lessons. E.j. equals Vs == I respect preferring free languages. But I love Kotlin
- Aaron2222 1y agoYou'll be happy to hear that Kotlin is licensed under Apache 2 then. From https://kotlinlang.org/docs/faq.html#is-kotlin-free https://kotlinlang.org/docs/faq.html#is-kotlin-free: Yes. Kotlin is free, has been free and will remain free. It is developed under the Apache 2.0 license, and the source code is available on GitHub.
- flanked-evergl 1y ago> especially that it's a proprietary language In what sense is Kotlin a proprietary language? It's Apache 2.0 licensed AFAIK. And there are many projects that use Kotlin which are not legacy projects. But to answer your question that is loaded to the brim with false assumptions/claims directly: https://kotlinlang.org/docs/comparison-to-java.html https://kotlinlang.org/docs/comparison-to-java.html
- Aaron2222 1y agoFrom https://kotlinlang.org/docs/faq.html#is-kotlin-free https://kotlinlang.org/docs/faq.html#is-kotlin-free: Yes. Kotlin is free, has been free and will remain free. It is developed under the Apache 2.0 license, and the source code is available on GitHub.
- Larrikin 1y ago>after Java 21/23, what's the argument for using Kotlin Having to use Java again when Kotlin exist
- gavinray 1y agoHonestly, lack of the ability to write free-floating functions in Java. Recent Java features like records, pattern matching, sum types via sealed interfaces have certainly made it a much more ergonomic and modern language. But having to wrap everything in "class" feels ludicrous to me. The other ones are lack of explicit null types (meant to be addressed by JEP "Null-Restricted and Nullable Types") and inability to write anonymous types for functions. For example, something like: fun withCallback( handler: (A, B, C) -> D ) In Java, you have "Function3<A, B, C>" etc
- adra 1y agoI love java and kotlin. The gap has certainly swayed way more in Java's favor over the last 5 years, but there are still a ton of great features that kotlin does first and if that gives java a target to run toward in a lagging way more legacy compatible rock solid way, isn't this just a win for both camps? Just consider kotlin (JVM) to be java-beta with slightly different flourishes, and you wouldn't be too far from the truth. Kotlin is also very big in pushing their other initiatives that aren't entirely directed at JVM at least for now, like cross compilation native targets, compile time serialization primitives, totally structured concurrency, etc
- rbehrends 1y agoAside from the often cited nullability issue, here is an (incomplete) list of important things that Kotlin still does better than Java: - First class, fully functional closures. - Non-abstract classes and methods are final by default. - Named parameters. - Easy to write iterators via sequence { ... } - First class support for unsigned types.
- ab5tract 1y agoAlso the ability to just put a function somewhere in the “bare” part of a namespace was something I didn’t realize I missed as much as I did.
- mr7uca 1y agoKotlin isn't just a jvm languague.