It's really cool that Kotlin is multi-platform: JVM, JS, and Native! I remember reading something about how this was achieved, but can't find it now. Does it use a standard transpiler? Where can I dig into how this is achieved?
01/20/2022, 4:27 PM
This article, and the related video, do a good job of explaining the overall architecture https://blog.jetbrains.com/kotlin/2021/10/the-road-to-the-k2-compiler/
I'm definitely not a compiler engineer, but I don't think Kotlin is a "standard transpiler" in the sense that the JS world would know, for example. Kotlin is a proper compiler with a common "front end" that parses the source code into an Intermediate Representation (IR), and then passes that IR to one of the "back end" targets for binary code generation. A transpiler is more source->source processing, while Kotlin is source->IR->binary (which in JS happens to be "readable source code", but it's still the JS "binary" as far as the compiler is concerned)
But Kotlin Multiplatform is definitely one of the coolest features of the language, for sure! Among programming languages, it's approach to multiplatform seems to be fairly unique (compiling directly to the target platform's binaries, rather than running a VM in the target platform)