https://kotlinlang.org logo
#webassembly
Title
# webassembly
n

napperley

08/24/2019, 1:41 AM
Wonder if the changes might indicate extended WASM support, that makes its appearance in a Kotlin 1.4 release.
Looks as though the changes are for a new Kotlin development platform (Kotlin/WASM?). Could that mean there is a new Kotlin development platform that makes its debut in the Kotlin 1.4 release?
g

gildor

08/26/2019, 4:59 AM
I doubt very much that it will be available in 1.4
s

sdeleuze

08/26/2019, 9:50 AM
Yeah that’s just the bootstrap IMO
But still great news
n

napperley

08/26/2019, 10:05 PM
Actually that commit is for adding WASM support to the Kotlin JS compiler (see yole's comment: https://www.reddit.com/r/Kotlin/comments/cvo91h/webassembly_as_a_supported_target_is_coming/ ). A bit surprising that Kotlin JS is getting WASM support. Why is Kotlin JS getting WASM support?
g

gildor

08/26/2019, 11:31 PM
A bit strange interpretation for me. Different backends for Kotlin are parts of the same compiler, also going to share more logic in future between them So, because it has own backend and own stdlib, it's new a new Kotlin target platform, even if this platform will reuse parts of another one. It's first platform that can share big parts of tooling with another one and you definitely need a lot from Kotlin JS if you target Wasm for web: interop with js, browser API definition, integration with js infrastructure
2
n

napperley

08/27/2019, 2:32 AM
With the upcoming Kotlin Conf JB "might" shed some light on the WASM situation in Kotlin 🙏 .
g

gildor

08/27/2019, 2:36 AM
Yes, most probably
b

bashor

08/27/2019, 10:44 AM
@gildor is right, it’s another backend, but it’s not isolated, so of course it will reuse things already done as much as possible, e.g. in the new Kotlin/JS and K/N backends, in K/JS tooling and so on.
👍 4
n

napperley

08/27/2019, 9:42 PM
Presumably WASM support in Kotlin Native will be extended significantly?
g

gildor

08/28/2019, 12:30 AM
Personally, I don't think that it will be supported, there are some limited use cases for K/N -> wasm, also it already supported by llvm, so probably it will not be dropped, but I don't see why would it be extended. If wasm is your primary target, you definitely don't want to use llvm implementation, if you target MPP than just use wasm as platform. The only valid case for k/n wasm, which I see, is when you have existing k/n only app, that probably uses some C dependencies and you want compile it for browser (and do not use js APIs) or upcoming desktop/serverless/etc wasm runtimes.
n

napperley

08/28/2019, 2:54 AM
Another use case for using Kotlin Native to target WASM is to port existing Kotlin Native libraries to the WASM side.
g

gildor

08/28/2019, 3:35 AM
yes, “existing k/n only app” just should be “existing k/n only project”, so I believe it’s the same use case
s

sdeleuze

08/28/2019, 7:07 AM
port existing Kotlin Native libraries to the WASM side
Kotlin/Native is still very new I don't think that's a wide use case. If you want to port code to multiplue platforms use multiplatform code IMO.
1
g

gildor

08/28/2019, 7:18 AM
if you use C dependencies it’s another story, but I agree, instead of support rare K/N wasm better focus on K/Wasm