3 ms·
How so? Kotlin doesn't even have proper pattern matching.
by hocuspocus 5y ago
How so? Kotlin doesn't even have proper pattern matching.
- high_density 5y agonewb here -- please expand more on this. Are there stuff that kotlin's pattern-matching can't do?
- valenterry 5y agoYou can find some discussion and good examples here: https://discuss.kotlinlang.org/t/destructuring-in-when/2391/7 https://discuss.kotlinlang.org/t/destructuring-in-when/2391/...
- MrPowers 5y agoHere's a quote from Reynolds, one of the creators of Spark: > The primary issue I can think of comes from the lack of pattern matching. Kotlin’s language designer left out pattern matching intentionally because it is a complex feature whose use case is primarily for building compilers. However, modern Spark (post Catalyst / Tungsten) look a lot like compilers and as a result the internals would become more verbose if built using a language that doesn't support pattern matching. Source: https://www.quora.com/profile/Reynold-Xin https://www.quora.com/profile/Reynold-Xin
- serial_dev 5y agoWhat they probably meant is that both Scala's and Kotlin's improvements pushed Java to improve. Both languages had many different features that back then weren't available in Java but since then got added to the Java language, and that made Java better, too.
- hocuspocus 5y agoI still don't see how Kotlin is involved. People drafting JEPs are well aware of how modern languages, including the ones running on the JVM, have evolved in the past decades. Kotlin is pretty late to the party and hasn't really brought anything new to the JVM (by choice), except for coroutines maybe. Edit: see pron's comment below.
- RhodesianHunter 5y agoKotlin becomes the default on Android, more people are writing Kotlin, there's more pressure on Java to adopt the best Kotlin features. If you look at most of the recent additions to Java, they were in Kotlin from the beginning. This is no coincidence.
- hocuspocus 5y agoAnd they were in Scala, Groovy, C# ... before Kotlin was even a thing. There's zero evidence people on the OpenJDK governing board care about Android at all, rather the opposite.
- blacktriangle 5y agoExcept Scala brought along some improvements and a whole managerie of other features to manage, Groovy with its gradual typing was simultaneously too far away from Java and yet too similar, and C# means opting into a whole different platform and perpetually living downstream of whatever MS wants to do. Kotlin absolutely nailed the "meaningfully better than Java while staying pedantically true to the existing semantics" in a way that none of the alternatives did even if they did come first.
- hocuspocus 5y agoIt is still completely irrelevant to Java's evolution since Java 7.