4 ms·
Why is Kotlin a better language for Android dev? Won't the platform APIs designed for Java look and feel very non-idiomatic in Kotlin?
by fooker 9y ago
Why is Kotlin a better language for Android dev?
Won't the platform APIs designed for Java look and feel very non-idiomatic in Kotlin?
- jackmott 9y agoapparently you can actually make the api feel better, per Yegge. Probably due to extension methods.
- naasking 9y agohttps://kotlinlang.org/docs/reference/java-interop.html https://kotlinlang.org/docs/reference/java-interop.html Android is stuck on older Java versions. Kotlin brings Java 8 improvements, and more, without all the Java baggage.
- 2bitencryption 9y agoso if kotlin can bring java 8 features/improvements to a platform that is stuck on an older JVM (and not even the "true" JVM, but another implementation of it), then does that mean these features are not dependent on the runtime? If that's the case, these "java 8" features could be implemented into the Java language without needing to change the runtime? If that is true, why are these changes not being brought to Java itself, if they can be done without a change to the runtime?
- TylerE 9y agoI'm not sure if this is the case, but often it is _possible_ to implement something in, e.g., the stdlib, in a way that is _functional_, but with the right VM support it might be much more performant.
- deleted 9y ago[deleted]
- kuschku 9y agoTake for example Lambdas. Android has no invokedynamic, so every lambda has to be compiled to a class with a method. Android only allows 65k methods overall per linked unit, so that quickly becomes an issue. Kotlin, on the other hand, can do much more intelligent transformations (look at its inline functions).
- agildehaus 9y agoIs Kotlin why Google killed Jack & Jill? Do they have no intention of supporting Java 8/9?
- AlphaSite 9y agoNo, Jack & Jill were horridly poorly performing, thats why they killed them.
- yincrash 9y agoJack didn't work properly with a lot of things, so Google just changed the approach. https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html https://android-developers.googleblog.com/2017/03/future-of-...
- atemerev 9y agoNo. Kotlin is designed with Java interoperability in mind; it is the language design top priority (unlike e.g. Scala and Clojure).
- davidf18 9y agoScala has good Java interpretability. What more does Kotlin provide of Scala which is the implementation language for Spark and Akka, etc.
- roflc0ptic 9y agoAs far as I've experienced, Scala has excellent interop with Java. What do you find lacking?
- throwaway7645 9y agoKotlin is far simpler than Scala which has a big emphasis on functional programming and OO, so not going to be super popular soon. It's also behind Kotlin in good ide support. Clojure is simpler, but mainly focuses on functional programming and is a lisp as well, so will also not be a great candidate for the masses.
- flavio81 9y agoFunctional programming has surged strongly in popularity these last couple of years. As pointed out, other JVM languages also have "Java interoperability" as top priority. Clojure does. Clojure is getting popular lately, why isn't a "great candidate for the masses"? Because it is a Lisp? During most of the 1980s, the #1 programming language to teach children how to program was LOGO, which is basically Lisp in disguise...
- throwaway7645 9y agoIf something doesn't have algol syntax, it generally doesn't do well with the masses. Look at where Common Lisp & Clojure sit on the TIOBE list(do they even break the top 20?) FP is picking up some steam, but I fear lisp never will especially with such fragmentation of language and vendor. I'm not really familiar with Logo, but it doesn't sound like it had parenthesis or brackets like Rebol (something to make it homoiconic), and since it is not in use anymore...that might be proving my point.
- vbezhenar 9y agoYes, it'll be non-idiomatic, not very non-idiomatic, because Kotlin is not that far from Java. Kotlin is better than Java even for consuming Java API. And you can write Kotlin wrappers around this API to make it better. I've written few Kotlin applications. I didn't use Kotlin libraries, I used only JDK and Java libraries. I never felt that I would be better using Java. Kotlin is better in every aspect or at least not worse.