Kotlin native vs Rust


Did any one tried both languages, if so, what are your observations/comments that can be used to define pros and cons for each one comparing with the other.


Discalimer: I have a little bit experience with Rust, solid experience with Kotlin, no experience with Kotlin Native, but I have some thoughts :wink:

I think the main difference is that you have much more control what the computer actually does in Rust. It is harder to learn and use Rust, but you can squeeze out the last bit of efficiency. Another difference I see is that Kotlin Native is relatively new and immature whereas Rust already has matured a bit (although it is also new compared to it’s main competitor C++). The Rust ecosystem is probably a lot bigger. Kotlin uses garbage collection at runtime whereas Rust checks memory management at compile time. Rust is cleaner in some aspects, because compatibility with the Java legacy (null, abstract class/interface with default methods) was not a design restriction. From a programmers point of view Rust is more functional and less object oriented, you can see this in error handling, pattern matching and the absence of null and classes.


The main difference is memory management system. In Rust memory management is done mostly in compile time. On one hand, it allows to make programs with much smaller memory consumption, on the other hand, it complicated development a lot. Rust and K/N use LLVM as a backend so performance should be more or less the same. The language syntax (excluding borrowing) is similar.

Rust is much older than kotlin, but it did not manage to step outside its initial development niche (web-browser and other memory-critical system applications).I think, that for those you should use Rust. For non-system applications, kotlin has better potential.