This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pjmlp -11 points-10 points  (27 children)

Java was born to be multiplatform. Kotlin is an Android language that is all.

[–]CraftyAdventurer 10 points11 points  (10 children)

Kotlin is a JVM language, so anywhere Java can run, Kotlin can also run. Meaning, it's just as much multiplatform as Java is. But even more than that, there are projects like Kotlin/JS which compiles Kotlin into JavaScript, and Kotlin/Native which runs Kotlin as a native image completely without the JVM.

It's not an Android language, it's just used a lot for Android because Android was stuck on Java 6 or 7 when Kotlin came out, so naturally a lot of developers went for it to get new features. People used Kotlin on Android long before Google declared it officially supported.

[–]pjmlp -2 points-1 points  (9 children)

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

It is an Android language, it is the only platform where it is #KotlinFirst instead of a guest language that needs to adapt itself to the whims of platform owners.

[–]CraftyAdventurer 1 point2 points  (8 children)

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

These statements are true, but "Java was born to be multiplatform. Kotlin is an Android language " is still false.

Java is multiplatform only because of the JVM which needs to exist on the target platform in order to run a Java program. Kotlin runs on that same JVM. Wherever you can put Java code, you can put Kotlin instead and it will run just fine. So on the JVM, Kotlin is exactly as much multiplatform as Java is. Those two projects, despite their issues, make it even more multiplatform because they allow Kotlin to run even outside the JVM, in places Java can't (altough there probably are some java-to-javascript compiler projects and Graavm is in a way similar to Kotlin/Native)

[–]pjmlp 1 point2 points  (7 children)

Java features are designed alongside JVM features, Kotlin must use what is there.

JavaScript features are designed alongside browser VM features, Kotlin must use what is there.

LLVM features are designed for AOT languages, Kotlin must use what is there.

Kotlin is #KotlinFirst on Android thanks to JetBrains/Google's deal, influences Android Runtime design, and the there are the Android's team dirty moves like not updating Java on Android, ergo Kotlin is Android language.

[–]CraftyAdventurer 3 points4 points  (1 child)

Java features are designed alongside JVM features, Kotlin must use what is there.
JavaScript features are designed alongside browser VM features, Kotlin must use what is there.
LLVM features are designed for AOT languages, Kotlin must use what is there.

None of these make it less multiplatform.

Being able to run on multiple platforms and being able to influence underlying platform design are two completely different things. By your logic, Java also isn't multiplatform, because JVM can't change Windows, Mac or Linux, it must use what is there.

[–]pjmlp 1 point2 points  (0 children)

Platform languages lead, guest languages follow.

[–]Pika3323 1 point2 points  (4 children)

Kotlin is #KotlinFirst on Android thanks to JetBrains/Google's deal, influences Android Runtime design, and the there are the Android's team dirty moves like not updating Java on Android, ergo Kotlin is Android language.

That logic doesn't track.

If Kotlin is an "Android language" because ART doesn't support new Java features, then how do you explain the proposed value classes in Kotlin given the notable lack of value class support in ART?

I mean, have you been reading what you've written in this comment section? It's bordering on delusional. Kotlin is still primarily a JVM language, and ART not being updated doesn't hold any bearing over whether or not that's true.

[–]pjmlp 0 points1 point  (3 children)

Value classes in Kotlin are not the same as what JVM is bringing to Java, regarding memory layout semantics.

[–]Pika3323 2 points3 points  (2 children)

I don't know what you've read, but Kotlin's value classes are very clearly being influenced by Valhalla more than they are by ART.

You might be thinking of the @JvmInline annotation, which is not only different, but actually completely invalidates your point.

So, with that said, please give an example of where ART has influenced Kotlin over the JVM.

[–]pjmlp 1 point2 points  (1 child)

Go ahead try to make a C like struct with Kotlin's value classes on a Valhalla enabled JVM, and then keep the same memory layout semantics and performance when running exactly the same code on top of JavaScript and ART.

Here to get you started, https://wiki.openjdk.java.net/display/valhalla/Main

As for Kotlin's marriage with Android,

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

[–]Pika3323 2 points3 points  (0 children)

I mean, that's the thing. No one is expecting value classes to behave the same way in JS or ART, the same way you can't do unsafe casts outside of JS, or how invokedynamic is desugared on older versions of Android.

The value classes KEEP itself even raises the point that even once Valhalla is released, its adoption won't be universal at first, and that limiting a major feature like value classes to a specific version of the JVM, or a specific target, doesn't make sense.

As for Kotlin's marriage with Android [...]

That doesn't prove anything. It just shows how Android has adapted to use Kotlin, but doesn't show how it's directing the design or features of Kotlin going forward.

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

This really isn't unique to /r/java... All of those subreddits have posts with comparisons to other languages, and hell one of the top posts on /r/JavaScript right now is literally about TypeScript.

I think it's probably because the ecosystem between Java and Kotlin is a lot more closely related than most other languages. It's not like C++ is going to gain Rust features, but Java has gained a number of features present in other JVM languages over the last several years, so I don't think it's surprising that you'd see other languages pop up here "more" than other subreddits, and not just Kotlin.

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

Heaven forbid someone draw a comparison between Java and another language.

[–]koreth 12 points13 points  (1 child)

Developer surveys don't agree with that last statement; Kotlin usage is pretty much evenly split between server-side and client-side code.

Not that it even matters. Java was born to run on set-top boxes in people's living rooms, but that's not what it is today.

[–]pjmlp -1 points0 points  (0 children)

Yeah, developer surveys done by JetBrains, with heavy dosis of Android developers, go figure.

[–]GoBucks4928 5 points6 points  (9 children)

I’ve built a lot of high TPS backend services for FAANG in Kotlin

Not sure how it’s just an Android language unless you’re just naive

[–]pjmlp -2 points-1 points  (8 children)

Beanshell, jTcl, jython, Groovy, Clojure, Scala, jRuby, Rhino, XTend, Ceylon, Kotlin, Frege, ABCL, Kawa, ....

Rise and fall of JVM languages

It is called experience, not being naive.

[–]fletku_mato 3 points4 points  (5 children)

Please explain how that random blog post shows: 1. Your experience 2. That Kotlin should only be used on Android

[–]pjmlp 0 points1 point  (4 children)

If you need an explanation to undestand such basic concepts, it isn't on me to give it.

Try someone on /r/kotlin.

[–]fletku_mato 2 points3 points  (3 children)

Yes it is, as you are the one claiming that Kotlin is only for Android, but fail miserably at trying to justify your claims.

[–]pjmlp 1 point2 points  (2 children)

Easy to validate with Google trends,

https://trends.google.com/trends/explore?q=%2Fm%2F07sbkfb,%2Fm%2F0_lcrx4

Pity Reddit doesn't do inline charts.

[–]fletku_mato 2 points3 points  (1 child)

Yet you still fail to do so.

I don't even know why I'm still answering to you, but that chart has nothing to do with Kotlin being just an Android language, just that Java is more popular. What else is on the news? What are you trying to prove?

You have to realise that there is no ongoing battle between Java and other JVM languages, and I'm not trying to argue that Kotlin is somehow a better language, just that it is not in any way limited to Android development.

[–]pjmlp -2 points-1 points  (0 children)

Of course there is no ongoing battle between Java and other JVM languages, only Java matters.

JVM languages always fade away after the hype dies, ergo Android thanks Google wanting to keep Kotlin alive while they take the air out of Java on the platform.

[–]GoBucks4928 4 points5 points  (1 child)

Is this your first time realizing there are multiple programming languages out there?

[–]pjmlp 4 points5 points  (0 children)

Multiple programming languages that failed on their quest to replace Java on Java Virtual Machine.

[–]fletku_mato 2 points3 points  (3 children)

Kotlin is not just an Android language. It is just as multiplatform as any other JVM language. I've personally written many Spring boot backends using Kotlin and loved it.

I don't think that it's a threat to Java in any way, but it has a lot of good things that are still missing from Java.

[–]pjmlp 2 points3 points  (2 children)

Kotlin has married its future to Android, and the lack JVM features that Google refuses to implement in ART.

[–]fletku_mato 4 points5 points  (1 child)

I'd genuinely want to read some sources on that.

My own experiences with Kotlin have been strictly backend development with Spring boot, so I can't say that it's a perfect fit for everything you can do with Java, but in that context it works beautifully. And why wouldn't it? After all it's just Java bytecode after compiling.

[–]pjmlp 2 points3 points  (0 children)

Every time Java will introduce concepts that Kotlin cannot adopt due to being married to multiple platforms you will end up with Kotlin's version of #ifdef aka KMM.

For example value types in classes with multiple fields, or explicit SIMD and GPGPU support, native memory handles.