Has anyone tried porting the portion of the compil...
# webassembly
d
Has anyone tried porting the portion of the compiler required for WASM generation to WASM? It would be amazing to have a Kotlin version of Pyodide.
h
The Kotlin compiler depends on IntelliJ and Java Libraries. Switching the compiler to Kotlin common code (to run on all targets) isn't a goal right now.
a
May very well be I’m wrong, but isn’t CPython (and therefore Pyodide) to Python what the JVM is to Java/Kotlin? An interpreter of bytecode? So if you’re looking for something like Pyodide for Kotlin, it would be required to have a Kotlin interpreter/runtime compiled to WASM before - which is more or less what TeaVM is (https://www.teavm.org/docs/intro/overview.html). Haven’t tried that myself though…
s
The idea of multiplatform Kotlin compiler sounds awesome, but it is not a priority for the team in the near future. Kotlin compiler does indeed depend on Java code, and porting it to Kotlin multiplatform is non a trivial task.
m
At least JVM and WASM compiler would be awesome. There is little point in JS, and native one maybe, but then it would probably take ages to compile both itself and code.
d
@Svyatoslav Kuzmich [JB] Understood. I assumed it was non-trivial given the complexity of the compiler due to all Kotlin's features and the fact it is multi-targeted. My comment on Java related to requirements of the target. I hope at some point JetBrains considers making a WASM implementation of the compiler. Thank you to everyone who responded. Kotlin is lucky to have such an active community.
s
That’s my dream too, and that would IMO provide a strong competitive advantage against Java, but there are a lot of steps before making it possible, first class WASI support being one of those IMO.