Hacker News new | past | comments | ask | show | jobs | submit login

> Sometimes, the tooling is even more important than language features IMO. It makes developers move quicker, find bugs easier and so on. I like the idea of Kotlin, that it can compile to jvm bytecode, javascript and native.

The only thing I'd worry about is Java overtaking it.

Do you remember Coffeescript? There was a point in time where it had impressive adoption, and quite a bit of buzz. But then Javascript added features, and all of a sudden the tooling burden associated with Coffeescript just didn't make sense any more.

With Oracle's 6 month release schedule, that's a distinct possibility. Especially since Java can no longer rest on its laurels as a language (if Oracle doesn't want it to become Cobol 2).




Kotlin is plenty safe for now.

* Android is a massive platform, and Android is basically stuck on JDK8 (or JDK11 with desugaring, wooo).

* iOS compatibility-ish. KMM is not ideal and mostly generates ObjC compatible objects (so generics are mostly screwed for Swift and writing iOS code is not ideal, but even being able to define common and enforced contracts is cool. iOS benefiting from projects like SQLDelight is super cool)

* Jetbrains hedged their bets, and Kotlin/Multiplatform is a solid option. Coupled with Jetbrains Compose for UIs as well as having the entire Java ecosystem available is very solid. Compilation for so many platforms, directly to native executables is cool.

* Java is still very slow to evolve. Kotlin has had data classes for a long time, Java recently added records. Inline classes offer some nice type safety at basically zero costs. Coroutines and structured concurrency are a beautiful way to work, and Project Loom would only build the foundations of that. Context extensions (while terrifying in the potential for spaghetti code they offer) are a useful feature, reified generics have some great potential.

Now, Kotlin has its disadvantages too. Compilation times are not that great (hopefully K2 fixes this partly), but it's relatively safe and is kind of more than just a JVM language by now.)


I agree with everything you said except for "Java is still very slow to evolve."

New Java versions are cut every six months since 2017 and since then has added a significant amount of new features, syntactical sugar, APIs, et cetera. Not only that, but they've also have been pretty aggressive IMO in deprecating and removing legacy. Very very different than the Java I remember working in years ago.


> New Java versions are cut every six months since 2017 and since then has added a significant amount of new features

And yet, the overwhelming majority of the Java community are still using JRE8 with none of these new features.

There are some that love this new pace of language development, but very few are actually using new features in production code.


The hesitancy in jumping beyond JRE8 is the large backwards compatibility road bumps in JDK9-11, and now again with 17/JavaEE->Jakarta. I wish Java would continue to add new features but be a lot more considerate of avoiding, completely, migration headaches.

We are migrating Java 8 -> 17 now and it’s been a right royal pain. I’m glad we didn’t jump to 11 LTS, and instead make one big leap. It might be a very long time before we do another LTS upgrade if they keep making poor migration choices.


The only relatively bumby migration was 8->9. After that it is a very smooth ride, and that bumpiness was the price for the accumulated tech debt/slow down from the end of the Sun era.


Well, my understanding is (but I have yet to personally experience) the migration from 17 -> 18+ is rough because of all the javax.* packages being renamed jakarta.*

Which likely means touching a pretty significant portion of your codebase for the upgrade, and then who knows what 3rd party libraries you depend on are expecting...

So it may be as simple as Find/Replace for some folks, for others, it might be a deep dark rabbit hole.

Not breaking things used to be Java's MO. Yes, that means a ton of legacy cruft built up over the years... but we used to be able to depend on Java to "Just Work".

Perhaps some of this is necessary. After all, the C# folks seem to have no problem breaking everything to add new features... but I'd assert the Java community as a whole is much less tolerant of breaking changes and rapid deployment of features.


There are entire segments of the industry that has never touched any javax package - while no doubt widespread, I do believe that it is still a very fair price to pay, and none of these changes were even half as problematic as for example the python 2->3 migration. So I don’t know, I’m fairly sure it is impossible to keep a platform alive with even less/smaller impact breaking changes.


javax -> jakarta is entirely dependent on your dependencies not the vm.

There’s plenty of dependencies that provide javax implementations as well as jakarta.


8 -> 9 wasn’t that hard for me personally. For our applications it was just adding things to the build to make sure javax.xml was present.

The real difficulty for us was upgrading the Play framework since the Scala community likes to make breaking changes with every release.


In HN a while back, an Oracle dev pointed out that the evolution is slow for a reason. Which confirmed slow. New releases every 6 months, but not that much in the way of changes. This isn't criticism of the fact of it or going into why it is or whether it should be that way. It's just a statement of fact.


You're correct of course, but to back up the parents comment, they do have a habit of implementing things other than the low hanging fruit that developers are frustrated not having, leading the drive towards other jvm langs


What are some examples of those low hanging fruits?


Functional/SAM interfaces (transforming interfaces with a single method into a simple lambda), pleasant usage of lambdas (last lambda parameter can be put outside of the call like(this) { ... }, leading to a language that lends itself really well to building a DSL, coroutines were not a low hanging fruit but absolutely are infinitely more pleasant to use than RxJava, operator overload including invoke(), ranges that are pleasant to use (0 .. 10).forEach { }, or when (floatVariable) { in 0.0f .. 1.0f -> ... }, pattern-ish matching with when (not quite full on functional language powerful, and I believe that Java is not only catching up to it but making their switch quite a bit better), a standard lib that is packed full of extremely useful and consistently named methods, extension functions, delegation (if you inherited a SDK that has a piss poor interface, you can simply make a SDKWrapper(val internalSdk: SDK): SDK by internalSdk, which means that it will automatically implement it, and you can then have your wrapper do whatever around it (logging, better functions, DI, etc.)))

Kotlin is truly a pleasant language, both when you don't know it (although it can look a bit symbol soup-y at times for juniors), and when you fully know it.


Just browse through the Kotlin standard library. It's basically just a set of mappings to the Java standard library with a whole lot of extension functions to make it easier to use.


> iOS compatibility-ish

I don’t know how well it works, but we have seen these kinds of projects, and they seldom work as is. Not sure how well Scala Native works, even though it predates Kotlin’s try. (Though scala.js is surprisingly good!)

But do you really think that a relatively young language like Kotlin with minuscule adoption (compared to java) will be better at this game then Java?

Java has a very good compiler to Js maintained and used heavily by Google (j2cl, part of their closure compiler toolkit), which can also output obj-c code. These are/were used heavily for porting their shared libs between basically all platforms.

For native, Graal is a very cool way forward benefiting all JVM languages (as well as scripting languages, its polyglot features are insane).

> Java is still very slow to evolve

Is it a problem? The majority of developers don’t like running after the language, even though it may seem so based on online hype circles.


>I don’t know how well it works,

Well enough, provided you stay within the known bounds. Hell, some people at Touchlab even went as far as porting Jetpack Compose to work on iOS (which, uh, I would not recommend in its current state), and it technically works. I probably wouldn't recommend writing all of your app logic in Kotlin, but being able to share the data layer is amazing.

>But do you really think that a relatively young language like Kotlin with minuscule adoption (compared to java) will be better at this game then Java?

It depends on where you're looking. Most modern android development will most likely be done in Kotlin. Backend work, for things started relatively recently, Kotlin is not surprising. But mostly, Java does not make iOS compatibility a goal. Java tell you "get a JVM and run our shit" (or get GraalVM and have basically an embedded JVM). Kotlin has two sides, and Kotlin/Native does not depend on the JVM.

>Java has a very good compiler to Js maintained and used heavily by Google (j2cl, part of their closure compiler toolkit), which can also output obj-c code. These are/were used heavily for porting their shared libs between basically all platforms.

j2cl still brings in a light JVM to the Web. Kotlin does not. It provides interop to the JS APIs as well as its own tech, but it's not meant to take your Kotlin code and immediately run it on the web (which is an awful, awful idea). You're still meant to write your browser specific code, your android specific code, your x86 specific code, etc. In any language you want, even! Write it in Kotlin/JS, or let your typescript consume the Kotlin/JS bindings. However, you can have a common base that'll work everywhere.

> For native, Graal is a very cool way forward benefiting all JVM languages (as well as scripting languages, its polyglot features are insane).

Graal is an extremely cool project, but with different goals. Write once, run everywhere is a lofty goal, but it only works on very similar platforms (Windows/Linux/OSX). Kotlin has taken a Write once, specialize what is needed approach.


> even went as far as porting Jetpack Compose to work on iOS

Well, Gluon promises the same for JavaFX apps and there is a sample app actually downloadable from the AppStore.

> j2cl still brings in a light JVM to the Web

Not at all, it compiles to very optimized Javascript. Oh, and I forgot to mention that there is also teavm, which is not a VM contrary to its name -- this latter transforms java byte code so it works with guest languages as well.


  > but being able to share the data layer is amazing.
why not just use swagger/openapi + auto generated models?

adding kotlin native adds huge depenencies relative to the tiny benefit of a datamodel that can be auto generated to native code imo


Swagger + OpenAPI generates data classes for you, and maybe a Retrofit/Ktor/Whatever interface. It does not handle repositories, data fetching, caching and combining, it does not handle a SQLite database.

Which dependencies ? If you already have Android devs, on the iOS side it adds a single swift package, and similarly so on Android.


  > It does not handle repositories, data fetching, caching and combining, it does not handle a SQLite database.
right, but you can use that to autogenerate all those things (have done it before) with a few additional tools (code templates) and have it all (repositories, fetching, caching etc) automated (there is a limit of course, combining might be a bit hard in that case)

this is really useful though because now you can deploy to more platforms in their native languages using idiomatic code, and switching to newer techniques, e.g async/await can be done instantly just by updating the source template which any team can download and compile themselves

  > Which dependencies ? If you already have Android devs, on the iOS side it adds a single swift package, and similarly so on Android.
for ios, its including basically the whole kotlin runtime and additional support (kotlinx-datetime, etc) in that single package (xcframework), then add a lot of data classes and things start to add up... for us its one of the biggest single dependencies on our ios app


Do languages really need new features every N months to stay relevant?


Depends. Is stuff like context receivers (https://nomisrev.github.io/context-receivers/) needed ? No, although it's a fun experiment. Are multiple receivers needed (https://youtrack.jetbrains.com/issue/KT-10468/Multiple-recei...) ? Not really, but when you are dealing with the JVM, nested class hell is a very common thing, and cleaning up your code is always pleasant. Implicit namespacing ? (https://youtrack.jetbrains.com/issue/KT-11968/Research-and-p...) Fun thing to get.

The thing is, they're all optional. You're never going to use any of these features if you don't need them. Your code can stay as a nested list of calls. But put them all together, and you can have code that is super explicit about what it needs to do, without having to re-pass things that are already there.


> Do languages really need new features every N months to stay relevant?

I think a fixed N month release schedule is much healthier than what Java did before, which was wait until everyone was on the bus in order to ship, which resulted in multi-year delays.


No, but fortunately Java doesn’t do that. They have long running projects, when one is nearing completion it will be put in preview in the upcoming release. No rush to make it into anything, it’s ready when it’s ready. (Which should be copied by the rest of the industry as well)


Depends. Are the features making things better, or just more complicated?

Even if it makes things better only for, say, 10% of users, but doesn't make it worse for the other 90%... the users will take that every N months for as long as the language authors can do it.


I’m not a Kotlin user, but this struck me as ambitious:

> having the entire Java ecosystem available

and, in the same point:

> Compilation for so many platforms, directly to native executables

Does this mean you can compile pretty much any Java libraries to non-JVM executables?


No, if you are targeting a different platform you can't use JVM libraries.

If your target is JavaScript, you can use JavaScript dependencies (sort of: they won't have any type bindings so you will need to code then yourself) but you can't use any JVM libraries on it.


As other said, yep, you do not get the Java ecosystem if your target is native executables (or JS). there are alternatives like kotlinx-datetime, kotlinx-serialization, the kotlin stdlib. However, if you know you're going to stay on a JVMable target, feel free to not use Kotlin/Multiplatform, but regular JVM Kotlin libraries


No, if you use Kotlin native you do not get access to Java libs.


Slow to evolve and long-term backwards compatibility are selling points.


Wasn't it Typescript that made CoffeeScript obsolete? Not better JS


IIRC the main appeal of CoffeeScript was syntactic sugar like lambda expressions etc that were missing in ECMAScript 5. I think ECMAScript 6 made most of the appeal of CoffeeScript obsolete


When CoffeeScript came out, I vowed never to write plain Javascript again. I kept to that vow for a couple years, but eventually broke it when ECMA 6 came out. Really the only thing that put real technical justification behind CoffeeScript was the double arrow function, and maybe the neat class syntax. Beyond that CoffeeScript is just prettier. Even though I was in charge of choosing the technologies, you got to skate where the puck is going, and the puck was clearly not staying with CoffeeScript.

ECMA 6 copied all the good parts out of both CoffeeScript and jQuery, effectively obsoleting both. Modern JavaScript is almost unrecognisably different from what it used to be, and that's a very good thing.


The availability of lodash made us dump any ideas our shop had about widespread coffeescript use.


"Our codebase is in CoffeeScript" tended to draw grimaces for years before Typescript came around.

And no, they serve totally different purposes. Coffeescript tried to make JS syntax and variable scoping behavior non-shit, while Typescript adds static typing while changing very little about the core language syntax.


CoffeeScript never became popular in the first place. I stopped seeing it anywhere even before TypeScript caught on.


It was a thing for a hot minute in the early 2010s, before ES6, TypeScript, and the React/Angular/Vue trifecta came along and solidified what JavaScript would be from ~2015 onwards.


I ran into Coffeescript code on GitHub for the first time in years last week. Oh, Coffeescript, I remember that used to be a thing.


It was the default for a while for Rails apps and Wiki tells me GitHub & Dropbox adopted it before moving to Typescript. I think for Rails shops it was popular and there was a brief time where it looked like it might become the thing to do on the front end. But I don't think it ever got the interop with existing JS right.

Ultimately, improvements to JS came along and took the wind out of CoffeeScript's sails. Then TypeScript came along and killed whatever interest remained.


Really, it was a combination of both.


You are correct. Typescript killed any momentum coffeescript had.


Don't forget about WASM as another platform; it's coming as well. An experimental version actually ships with 1.7; it's just a bit unstable and under documented and very much a work in progress.

I think Oracle is catching up slower than Kotlin has been evolving in terms of new language features. Most of the stuff they add to Java (including most of the stuff they are talking about adding), Kotlin has been doing for quite some time. Kotlin is pushing out minor releases about every 3-4 months and major ones pretty much every year. Basically, they do 2-3 minor versions in between major ones. The pace is relentless.

If anything, Kotlin could use an LTS release because it's actually getting hard to keep up with the ecosystem.

A slower pace might be helpful with that. The main issue with frequent releases is that many libraries take weeks or even months to update and don't necessarily work well (or at all) with newer Kotlin versions. I've had repeated issues with e.g. code generation plugins requiring specific version of Kotlin breaking because some other library suddenly requiring something newer. So that then starts blocking a lot of library updates. We've actually put some effort in unblocking some of this for some of the dependencies we have by creating pull requests.

But I'm excited about the next 1-2 years. I expect Kotlin native to stabilize and grow beyond just being a thing for IOS. I also expect wasm support will become usable in that time frame. I hope to be able to use it with WASI for edge networking or serverless stuff. And maybe even some command line tools. IMHO Kotlin has potential for data engineering as well. There is actually jupyter support for Kotlin. And some machine learning frameworks. It's becoming a proper full stack language.


Yes that's right. In fact, Kotlin really works well with the IDE. But they didn't spend as much time in creating a language with a good and sound theoretical foundation. This works in the short time but shows its flaws later. Java is a bit better here (but quite slow though).

So yeah, I can see Java potentially overtaking Kotlin.


I don't know about that comparison. CoffeeScript transpiled to JavaScript- Kotlin doesn't transpile to Java, it compiles to JVM bytecode.

So in a sense, from a tooling and compiler perspective, they're orthogonal products, similar (I guess) to C# and F# on the .NET CLR VM.


This kind of happened to Groovy, but I think Kotlin was the killer in that case.


Groovy was too much of a "scripting feel" to it, maybe because the primary project was Gradle.

Scala had a massive much more prominent project to rely on - Spark.

Kotlin is getting traction because of Android.


> Kotlin is getting traction because of Android.

Kotlin is seeing major adoption on the server.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: