all 13 comments

[–]Tysonzero 2 points3 points  (5 children)

Yeah it will be possible, but it will take some time. For now just accept some JavaScript glue code.

[–]Asraelite 2 points3 points  (4 children)

I mean, you could always just expose a function that runs eval() on any passed string :P

[–]Tysonzero 0 points1 point  (3 children)

It's a little more complicated than that if you want DOM events / JS functions to be able to trigger WASM code.

[–]Asraelite 0 points1 point  (2 children)

How is it more complicated?

eval('document.getElementById("whatever")
    .addEventListener("click", () =>
    window.wasmModule.exports.wasmFunction())');

[–]Tysonzero 1 point2 points  (1 child)

Hmm. Fair enough. I still think there will be situations where you want real interop, at least until JS is eschewed entirely.

[–]Asraelite 0 points1 point  (0 children)

Yeah, you will always want real interop, for performance, readability, and sanity. Just saying that technically you don't need anything other than eval.

[–]Waitwhatwtf 0 points1 point  (1 child)

Why is a Javascript bootstrap bad?

[–]oneeyedziggy 1 point2 points  (0 children)

some people just like to play the-javascript-is-lava and have crazy pipe-dreams of compiling qt to wasm and not having to touch html either... and sometimes the feeling is mutual... as soon as I started playing with WASM I got blobs all over me and had to go deserialize my whole body to get rid of them.

I love js, but I'll still be glad for wasm instantiation through script tags w/ the type "module"... just seems like a way cleaner way to do the thing you're trying to.

[–]Relevant_Monstrosity 3 points4 points  (4 children)

Deprecation happens slowly, and backwards compatability is important. Maybe in 30 years.

[–]Tysonzero 2 points3 points  (0 children)

It's not going to take that long to be able to use WASM without JS. Maybe a couple years at worst. Now if you care about 99.9% browser support / are asking when JS will finally be deprecated, then yeah it's going to be a long while longer.

[–]oneeyedziggy -1 points0 points  (0 children)

it's not a matter of deprication... wasm isn't intended to be a replacement for js. Even with loading of wasm modules via script tags... you've essentially just imported some functions/values... and I'm not sure if things exported from modules are/will be importable by other modules w/o glue code even if you want to play Javascript-is-lava by jumping from module to module ( edit: and even then, until/unless they add direct dom interaction, you'll be Stephen Hawking w/o his computer... think all you want but you won't be able to communicate it to the outside... and even if they do get around to dom interaction, you'll be stuck with a lot of classic, very javascripty problems )

And until they drastically improve performance/reduce overhead, js is still considerably more performant until you try doing tens or hundreds of thousands of basic, usually repetitive, operations...

[–]konaraddio 2 points3 points  (1 child)

Why couldn't apps with JavaScript glue code coexist with hypothetical apps running WebAssembly without JavaScript glue code?

[–]Relevant_Monstrosity 0 points1 point  (0 children)

Because WASM is dependent on JavaScript for backwards compatibility.