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

It's odd to talk about js target and not wasm #33

Open
Laeeth opened this issue Jul 6, 2019 · 5 comments
Open

It's odd to talk about js target and not wasm #33

Laeeth opened this issue Jul 6, 2019 · 5 comments

Comments

@Laeeth
Copy link

Laeeth commented Jul 6, 2019

It seems to me a much less common thing to want to do to compile to js than wasm. But you mention js and not wasm. It makes it look like you are writing the feature comparison to cater to the peculiarities of the language you advocate rather than what's actually likely important to users.

I suppose both D and Nim compile to wasm. Right now for D you lose the runtime. But once there's a better way in wasm to manage memory then we will probably support the development of a port to wasm. Sebastian Koppe has ported std allocator to wasm already.

@timotheecour
Copy link
Owner

PR very welcome to clarify/update this; no bias was intended at the time I wrote this; since then, there have been some updates wrt wasm, see relevant links:

that being said, js as a compilation target does have its use, wasm can't do everything (or as conveniently) especially relating to DOM

@Laeeth
Copy link
Author

Laeeth commented Jul 11, 2019

V sorry but I have no time - just about possible to file an issue from my phone but a PR is impracticable for me right now.

@Laeeth
Copy link
Author

Laeeth commented Jul 11, 2019

It's just if you don't mention that this is out of date and you link to it from Reddit then people could easily get the wrong idea.

@timotheecour
Copy link
Owner

btw, do you have the reddit link? i wasn't the one who put it up

@skoppe
Copy link

skoppe commented Oct 20, 2019

that being said, js as a compilation target does have its use, wasm can't do everything (or as conveniently) especially relating to DOM

I wonder what specific DOM operations are easier when you compile to js versus wasm. Care to enlighten?

The way I see it, regardless of whether you target js or wasm, you are still going to need bindings/interfaces for the web apis in your language. (Nim/D/Rust/Go/etc.)

Currently with wasm you need some js glue code. But that is just an implementation detail. When the host bindings will arrive it will only require a change under-the-hood.

I have to admit that at various points I thought about targeting js as well, since it does avoid trampolining from js <-> wasm and back. However, those calls are pretty fast nowadays, and I don't think I want to write a js backend that emits as tight code as the llvm emits wasm.

Also, wasm can be parsed and compiled way faster than js. Firefox can do it at 70mb/s, which is a couple time faster than an end-user's network connection.

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

3 participants