Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-request] support wasm target #306

Open
VladislavSumin opened this issue Apr 19, 2023 · 9 comments
Open

[feature-request] support wasm target #306

VladislavSumin opened this issue Apr 19, 2023 · 9 comments

Comments

@VladislavSumin
Copy link

It is possibly to support wasm target? Coroutines and Compose libraries already have experimental wasm target support

@github-actions
Copy link

Thank you for reporting an issue. See the wiki for documentation and slack for questions.

@oshai
Copy link
Owner

oshai commented May 31, 2023

If you have any reference how to add such support to a lib I would be happy to add it. Of course contribution is also welcome.

@Laxystem
Copy link

If you have any reference how to add such support to a lib

WASM is a compile target, that similarly to JS, has browser and nodejs - but it also has d8 (no idea what that is tbh).

WASM Support will be very appreciated!

@oshai
Copy link
Owner

oshai commented Aug 13, 2023

If I understand correctly, our current "native" implementation (writing logs using println) can also work in wasm. So the main thing to add is the gradle configuration. No need for many code changes.

@Laxystem
Copy link

Laxystem commented Aug 13, 2023

Do note that when WASM is out of alpha, it'll likely have interop with other WASM languages, allowing for usage of more complex log libraries than the basic stdout.

Plus, you can use JS console in WASM - it has JS interop.

@oshai
Copy link
Owner

oshai commented Aug 13, 2023

Which impl do you think is the most appropriate?

@Laxystem
Copy link

Laxystem commented Aug 14, 2023

Which impl do you think is the most appropriate?

I think console, as it supports multiple log levels. However, println delegates to the standard WASM output. To allow for more consistent interop with other languages (when the time comes), I would suggest both - by making one the default and the other an add-on artifact.

The same, btw, applies to println - if you choose to only implement that, interop with JS will be less consistent.

(console supports, iirc, debug, normal/info, warning, and error, while println is only normal/info and error)

@gsteckman
Copy link

Kotlin for WebAssembly is now alpha.

oshai pushed a commit that referenced this issue Jan 15, 2024
Partially solves #306.

No Node.js support for now, as it requires a canary Node.js version (21.0.0-v8-canary202309143a48826a08 or newer).

No WASI support also. Considering the raw state of Kotlin WASI, this currently seems too hard to implement.

Overall, this is a fairly simple implementation based on the jsMain and jsTest modules. I hope this will be ok as a first solution, just to provide initial support for WASM.
@severn-everett
Copy link
Contributor

What's left for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants