The potential of Kotlin/WASM
31–40 of 46 posts
Re: The potential of Kotlin/WASM
#32> But WebAssembly becomes even more interesting when you take another perspective. What if Compose for Web, the multiplatform incarnation of Jetpack Compose used on Android, would leverage Kotlin/Wasm instead of Kotlin/JS to perform pixel-perfect Canvas based rendering? It would not really be very web like. It'd be more like Flash or a Java Applet. User extensions would all be broken. This is a new thing coming peopl…
Compose for Web has a DOM toolkit as well as one that renders to Canvas. The Canvas toolkit lets you share code with Android and desktop JVM via the Compose UI libraries. The DOM toolkit renders to DOM nodes with its own API and minimal widget library. Having worked on a multiplatform Compose project, I would recommend rendering to platform-native UI if possible. Compose feels like a weird Electron UI on desktop, and…
For most of the similar frameworks exploring making the web a target, there is zero interest or care in "text/html". Flutter, Qt, Uno: they come bearing no gifts, no respect, simply seeing the web's very lowest levels as an efficiently accessible delivery target they can exploit, & they have zero compunctions about ignoring the 99.9999% of the web stack that all other sites use in favor of the low level graphical interfaces.
Re: The potential of Kotlin/WASM
#33disappointed that gilles.deleuze.fr does not get you anywhere
Re: The potential of Kotlin/WASM
#34Thank you for the work on KoWasm It's been exciting to watch the development of the new K2 compiler and Frontend-IR format Kotlin is no longer just a JVM language, but more like a frontend with targets that now span everything from JVM bytecode, JavaScript, native code with Kotlin Native, and WASM I'm really excited to see what the future holds for Kotlin and WASM in particular
The main things holding kotlin native back have been the compiler and the library ecosystem. The compiler has been making a lot of progress over the last two years. And the library ecosystem has a growing number of high quality multi platform libraries. So, there's less need for wheel reinvention.
Long term, given enough interest, it could start competing with Rust and Go for system programming type things. Right now, that's probably the weakest area for Kotlin but that is mostly because of the relatively immature library ecosystem around Kotlin native for this. IMHO the language actually fills a nice gap between Rust and Go. Easier than Rust, a bit more high level than Go. So far, Jetbrains seems more interested in mobile than in other use cases for kotlin native though.
Finally, Kotlin is actually a nice fit for data science jobs as well. Nicer than python to use for this and a bit less esoteric than things like Julia or R. There are some interesting libraries for Kotlin for this. But like with native this is all relatively immature and a bit niche at this point.
Some interesting things you might not be aware off:
- multi platform compose is a thing and as of recent releases it has an experimental IOS target as well. So, you can build desktop, android, web, and IOS capable applications now with using Kotlin. Unfortunately Desktop compose still depends on the JVM instead of using the native compiler. So, there's now a third alternative emerging next to Flutter and React Native for cross platform UI.
- ktor server can now be used with the native compiler. So you now have two ways of producing native binaries for ktor via graal and the kotlin native compiler. Great for use with e.g. lambda functions as well.
- kotlin scripting (KTS) is pretty nice and you can use it in more places than just Gradle. It works in Jupyter for example. Or you can generate github actions with it (we do this via krzema12/github-workflows-kt).
- you can plugin wasm to kotlin (and lots of other languages) via extism.org. Haven't tried this but looks intriguing.
Re: The potential of Kotlin/WASM
#35> But WebAssembly becomes even more interesting when you take another perspective. What if Compose for Web, the multiplatform incarnation of Jetpack Compose used on Android, would leverage Kotlin/Wasm instead of Kotlin/JS to perform pixel-perfect Canvas based rendering? It would not really be very web like. It'd be more like Flash or a Java Applet. User extensions would all be broken. This is a new thing coming peopl…
One thing I don't see discussed much is how much users are empowered by being able to inspect the JavaScript that is sent to their machine. I can inspect every line of code before it executes. I can look at exactly what data is being stored client side and modify it if I wish. The client side of apps are forced to be open source. Every major browser has excellent developer tools built in that allows us to do this. I'…
Re: The potential of Kotlin/WASM
#36Thank you for the work on KoWasm It's been exciting to watch the development of the new K2 compiler and Frontend-IR format Kotlin is no longer just a JVM language, but more like a frontend with targets that now span everything from JVM bytecode, JavaScript, native code with Kotlin Native, and WASM I'm really excited to see what the future holds for Kotlin and WASM in particular
It's increasingly a full stack language. I would say increasingly more so than javascript since it actually compiles down to native. So, you can use it in the browser, in the jvm, with node.js (not a great fit but it works), on edge networks or in lambda functions (with the native compiler or soon wasm), or on mobile devices. The main things holding kotlin native back have been the compiler and the library ecosystem.…
Julia and R are esoteric? For Data Science? Also, Kotlin would be relatively low on the list of languages I would use for DS. F# is higher.
Re: The potential of Kotlin/WASM
#37Re: The potential of Kotlin/WASM
#38I don't know if anyone else had the idea yet, but I would love to use Kotlin with Svelte on the frontend.
Re: The potential of Kotlin/WASM
#39Earlier quoted context omitted.
It's increasingly a full stack language. I would say increasingly more so than javascript since it actually compiles down to native. So, you can use it in the browser, in the jvm, with node.js (not a great fit but it works), on edge networks or in lambda functions (with the native compiler or soon wasm), or on mobile devices. The main things holding kotlin native back have been the compiler and the library ecosystem.…
> Finally, Kotlin is actually a nice fit for data science jobs as well. Nicer than python to use for this and a bit less esoteric than things like Julia or R. Julia and R are esoteric? For Data Science? Also, Kotlin would be relatively low on the list of languages I would use for DS. F# is higher.
Re: The potential of Kotlin/WASM
#40Earlier quoted context omitted.
One thing I don't see discussed much is how much users are empowered by being able to inspect the JavaScript that is sent to their machine. I can inspect every line of code before it executes. I can look at exactly what data is being stored client side and modify it if I wish. The client side of apps are forced to be open source. Every major browser has excellent developer tools built in that allows us to do this. I'…
I fail to see how some compiled, minified js is any better than wasm code.
And it's worse. Because wasm is a separate process, so now there's multiple things to debug & learn. Tools like wasm-bindgen generate complex glue code to bridge wasm and the host/js side. The wasm-verse brings a ton of new challenges to legibility.
Learning minified bundled js codebases can be daunting at first, but it's ultimately js, most often built with normal-ish stacks, and the code usually shows it's nature pretty quickly after setting some DOM event breakpoints. It's nowhere near the joy of view source, but it's not bad.
Notably Chrome m111 just turned on pretty printing by default, so the first couple milliseconds of opening the debugger should be significantly less overwhelming. You used to have to know to press the prettify button.