A few weeks ago I wrote the same application four times in four different JVM languages: Java, Groovy, Scala, and Kotlin, with a particular focus on the application using functional techniques and types as well as being reactive. I also included as goals complete test coverage with a preferred test framework from each language and complete build tooling, all within a single Gradle project.<p>The only significant sources of variance were the following:<p>a) Groovy's support for functional programming is starting to show its age. It worked with everything, though.<p>b) The Scala 2.12 compiler has at least one bug that appears to affect its interaction with Java 8 lambdas (in particular, in at least one case expr.method() and (expr).method() will not pass the compiler's typecheck, but { val x = expr; x.method() } does. (All three pass IntelliJ's typechecker for Scala.) Outside of this (aggravating) issue and slower build times, it did work.<p>c) Java works well with everything but ends up being quite verbose, especially in regards to a functional programming style (no surprise there).<p>d) Kotlin (1.0) works well with everything and is relatively succinct except for Mockito due to everything defaulting to 'final' - but it appears that Kotlin 1.1 fixes this with a compiler plugin.<p>Based on my experience with all four languages, I would definitely try adding Kotlin to projects. It seems to be surprisingly mature and stable given how much less time it has spent in development (relative to the other three languages.)
Kotlin for me is Java made right. It's not complex, it has awesome interoperability with Java, it uses JDK, not reinventing its own wheels and it has everything I need from modern language.<p>But it seems that Jetbrains has its own vision for Kotlin being a completely independent language. So while it works for me right now, I'm not sure if it will work in the future. They are going native and it'll bring a lot of changes, for sure. Honestly I would prefer it to stay as Java enhancer, as I'm not interested in Native and I need very little JavaScript interoperability, if any (probably just translating some common code between backend and frontend).<p>But we will see, I don't want to sound too pessimistic. Kotlin is the best language I've used so far.
Kotlin is not just for android apps.<p>Kotlin is getting first class support on next generation Spring web framework with functional programming support - <a href="https://speakerdeck.com/sdeleuze/functional-web-applications-with-kotlin-and-spring-5" rel="nofollow">https://speakerdeck.com/sdeleuze/functional-web-applications...</a><p>it's almost done with first class support for vert.x which is a high-performance reactive webframework <a href="https://github.com/vert-x3/vertx-kotlin-common" rel="nofollow">https://github.com/vert-x3/vertx-kotlin-common</a><p>The reactor project (erlang for the jvm?) is building first class support for kotlin <a href="https://github.com/reactor" rel="nofollow">https://github.com/reactor</a><p>I think its going to be a great year for building backend systems on jvm.
What I like about Kotlin is it's what you might call a "pragmatic Scala", and could find a sweet spot between Java and Scala where its added expressiveness allows it to shine, but Scala's complexity and performance issues aren't in evidence to scare the development managers into staying with Java.
I wonder how Kotlin's JavaScript backend compars to Scala.js in Li Haoyi's list of fundamental reasons for betting on Scala.js:<p><a href="http://www.lihaoyi.com/post/FromfirstprinciplesWhyIbetonScalajs.html" rel="nofollow">http://www.lihaoyi.com/post/FromfirstprinciplesWhyIbetonScal...</a><p>I have a few concerns about Kotlin's JS backend:<p>How much can the complete JS bundle be optimized by an advanced whole-program optimizer like the Google Closure Compiler?<p>Kotlin for JS has no reflection, and I think JetBrains should <i>not</i> look into that as they said they are. But is there powerful compile-time code generation instead, e.g. through annotation processors?<p>Is there, or will there be, a healthy ecosystem of pure-Kotlin libraries that can be used with both the JVM and JS?
For fun, I've been working on a simple hobby web server in Kotlin that wraps Jetty: <a href="https://github.com/danneu/kog" rel="nofollow">https://github.com/danneu/kog</a><p>I think Kotlin is the statically-typed language I've been waiting for, especially with the team's interest in native and JS targets.
I wouldn't touch Java if I could write something in Kotlin instead. I'm using Swift on a daily base and while it still has it's issues (compile times, breaking changes) it's a great language to work in and extremely similar to Kotlin.<p>Better type safety means less crashes.
The post specifically mentions using Kotlin Javascript to develop React applications. Are there any simple examples out there showing this? I'm not seeing any after a quick google search and look through the docs.<p>Developing a modern frontend app is complex enough with Javascript or Typescript. It's pretty hard to ask people to figure it out from scratch in Kotlin by just saying that it's possible but not showing how.