Is there any plans to allow building just pure was...
# webassembly
l
Is there any plans to allow building just pure wasm (without) any js interop by default? Like how with rust building for the
wasm32-unknown-unknown
target does not let you interface with the browser unless you use something like wasm-bindgen. Just wondering because it’s be cool to play around trying to build cosmwasm smartcontracts for the
wasm32-unknown-unknown
target in kotlin one day… or is this already possible assuming I do not interact with any web/js api in the kotlin code?
s
wasmWasi
target comes without JS interop and is intended to be used in JS-agnostic environments. Stdlib depends on a few imports from WASI, and if your platform of choice does not support these API, stdlib would need to be adapted or replaced.
And the platform would needs to support GC and exception handling Wasm features, which are relatively new.
👍 1
l
My wasm knowledge is still pretty surface level, haha. So bear with me. But I guess my question is more along the lines of this question: https://users.rust-lang.org/t/wasm32-unknown-unknown-vs-wasm32-wasi/78325 And how wasm from kotlin maps to the rust wasm targets. The wasi target effectively has ways to make system calls, and the wasmJs interops w/ js from my understanding. So I'm wondering if kotlin wasm will support building wasm that is completely agnostic to any outside environment like the
wasm32-unknown-unknown
target in rust.
Or is that just not going to be possible because kotlin wouldn't be able to implement parts of the standard library for such a target?
s
Standard library currently has 3 WASI imports:
fd_write
(for printing to stdout),
clock_time_get
and
random_get
. If you don’t need these, you can link produced modules with a “fake system” wasm module, which would ignore
fd_write
and provide dummy values for time and RNG, making it completely environment agnostic.
🔥 1
WASI will transition to a different API, leveraging Component Model. It will make “fake system” components a lot easier to make, and people will likely make something ready-to-use. Hopefully these will be enough for early experimentations, and if there will be a big interest, we could consider supporting it in Kotlin out of the box.
l
@Svyatoslav Kuzmich [JB] oh cool, got it, good to know. Thanks for the explanation!