4 ms·
It's already here. It's called Kotlin. And the community loves it so much that even the mighty Google had to adopt it. It's production tested in the largest an
by sandGorgon 5y ago
It's already here.
It's called Kotlin. And the community loves it so much that even the mighty Google had to adopt it.
It's production tested in the largest and hardest java ecosystem out there - android apps.
- kaba0 5y agoAndroid is tiny compared to the Java ecosystem. Also, Google embraces kotlin mostly because they can’t keep up with JavaTM’s development. OpenJDK is at version 17 with many important changes, terrific performance improvements, etc. Not long ago android didn’t have lambdas, but it is still around Java 8. Kotlin is just syntactic sugar of some newer java features on top of older java.
- jollybean 5y agoGoogle embraces Kotlin because of IP issues with Oracle.
- kaba0 5y agoNo, Google no longer uses anything that could have an issue with Oracle and haven’t been using for a long time. The lawsuit was about an older state of Java and Android.
- The_rationalist 5y ago> Kotlin is just syntactic sugar of some newer java features on top of older java. Looks like someone hasn't actually spent time discovering how amazing Kotlin is.
- zokula 5y agoKotlin is a PITA to work with and code compared to modern Java.
- The_rationalist 5y agoWell that seems absurd and a very unpopular opinion that would benefit from actual well quantified arguments
- kaba0 5y agoI have, but it always felt like not going the whole length with the features, when Scala did much earlier. So if I want a “better Java” I really don’t see why should I stop at half way there. Java is a decent language nowadays so I either just use that or something quite different.
- The_rationalist 5y agoI'm sorry but this looks like an ad-hoc black or white thinking. Language design is made of tradeoffs e.g between features and complexity. However contrary to popular opinion, I'd say that Kotlin actually has almost all Scala features and notably has important features that Scala does not (such as coroutines, reified generics, compile time safe tail recursive, etc) The most unique Scala feature seems to be implicits. While I'm not convinced by their usefulness, the feature will be available in Kotlin in a few months: https://github.com/Kotlin/KEEP/issues/259 https://github.com/Kotlin/KEEP/issues/259 I'd even argue it is more useful in Kotlin since the language is state of the art regarding it's ability toward making DSLs. The major features that Scala 3 has that Kotlin does not that I can identify are: 1) Pattern matching -> Kotlin is almost there, it has destructuring, a when control structure, and can express ADTs via sealed classes/interfaces. The limitations are: name based destructuring is not implemented. No destructuring in when blocks. However since java will be getting extensive pattern matching support in jdk 19/20 I expect Kotlin to catch up there and I recognize pattern matching can be a very useful feature. 2) union types and intersection types. While those are useful in a structurally typed language such as typescript, I don't see much usefulness for them in Kotlin. You can express union types via sealed classes somehow. The compiler plugin arrow meta brings union type support but I haven't tested it yet. As for intersection types it is on the roadmap. The main usefulness of union types I can see are the union of exceptions in catch blocks, that BTW Java supports, surprisingly. 3) higher kinded types I don't see much usefulness in higher kinder types What else could their use be beyond abstracting over collections? Every Kotlin collection implement the interface Collection<T> which enable this use case. Again, higher kinded types are supported by the arrow-meta compiler plugin. To me the very few pain points of Kotlin have nothing to do with functional features but are: 1) Inability to deflare a function parameter as mutable. Inability to declare for loop element as mutable. Which in fact are because of IMHO religious functional toxic beliefs about immutability everywhere. 2) no package private modifier (although java 9 modules are supported and they are working on the issue)