r/AskProgramming • u/LookAtThisRhino • Jul 07 '21
Will WebAssembly ever achieve mainstream status?
I'm a web developer and I don't like web development. I think we're trying to do a lot more in the browser right now than what we were ever meant to do. I might be a bit old fashioned, but I miss downloading a piece of responsive, powerful desktop software instead of using either an Electron monstrosity or a sluggish web app.
Having said that, something that really excites me is WebAssembly. For something that became stable in what, 2015, 2016, it just hasn't made a lot of progress. Why is that? Why haven't we seen WebAssembly really hit the mainstream? I know there are companies out there working on various WASM techs, Microsoft included, but it just doesn't really seem to get talked about. Thoughts?
9
u/rootException Jul 07 '21
Lots of game dev and x-plat tooling exports as Web Assembly. Usually targeting canvas for rendering. Occupies a similar space to where Flash used to exist.
If you play games online it’s everywhere.
5
u/sepp2k Jul 07 '21 edited Jul 07 '21
How do you define mainstream status? It is my understanding that all major browsers support web assembly and that most systems-language-to-browser-compilers¹ target web assembly. Is that not mainstream in the context of what web assembly is trying to be?
¹ Oh and also Unity.
2
2
Jul 08 '21
there are quite a few web tools and games that were brought to the web via webassembly. WASM was never meant to replace the current web dev workflow or building UIs.
5
u/jddddddddddd Jul 07 '21
I've not played with it in a couple of years but..
I don't think it has native DOM access ATM, so you still need some JS, and if you're using some JS, why not do it all in JS?
I don't think it has Garbage Collection baked-in (yet) and therefore you're restricted to using languages where you handle your own allocation of memory (C/C++/etc.) I think GC is coming, but haven't bothered checking.
Association with malware. A little while ago there was a report that X% of WASM found in the wild were bitcoin miners, etc.
Lack of developers? There's millions of (cheap) JS devs out there.
Happy to be corrected on any of the above, as, like I said, I've not really looked at it in a few years.
Oh, and you might want to try r/WebAssembly as you'll get a better (and possibly biased?) response there.
8
u/xroalx Jul 07 '21
C# can be compiled to WASM, so either it brings its own GC, or there already is GC in WASM.
3
u/jddddddddddd Jul 07 '21
I think it brings it's own GC, but I seem to remember reading somewhere that having to reimplement GC at the WASM level was inefficient (when compared to having GC baked into, say, the JVM).
But like I said, I've not looked into this much, and even then it was a few years ago.
3
u/cyrusol Jul 07 '21
4 is not a reason. You don't actually write WASM, you just compile anything else to WASM. So the devs do exist.
1
u/jddddddddddd Jul 07 '21
Can you compile JS to WASM now? (Like I said, I've not been in-the-loop for a while)
3
u/gcross Jul 07 '21
The point is not that you'd leverage WASM to recuit JS developers but that you'd leverage it to recruit developers trained in other languages.
If you just want to write JS for the front-end, then you may as well just write that and not bother with WASM.
-1
u/PabloDons Jul 07 '21
Not quite yet. There are limited tools for web development for anything other than js. Sure you could do it, but it's quite unproductive. I think 4 is a good reason. I'd reword it though: There are not many non-js web developers.
1
u/DerKnerd Jul 07 '21
Progress translated their Kendo library to Blazor, many features are supported already.
1
u/PabloDons Jul 07 '21
I don't think that's enough to get kendo users or even new devs to go blazor though. It's still less productive
1
u/DerKnerd Jul 07 '21
We actually considered Blazor for a simple reason, I was the only JS dev in the project. But we didn't have clear browser requirements, so we couldn't rely on wasm. Now, about a year later, we do have the requirements and I still bite my ass that we didn't use Blazor.
1
u/nemec Jul 07 '21
I don't think it has native DOM access ATM, so you still need some JS, and if you're using some JS, why not do it all in JS?
All web development requires JS, but that's not a strong reason to run your backend in JS, too. Lots of those "JS devs" out there know more than one language.
1
u/wastakenanyways Jul 08 '21
WASM is not backend, is frontend. And it does not replace JS but complement it. When OP said "why not do it all in JS" they meant all frontend, not talking about backend here.
And btw using JS in client is indeed a strong reason to use it on server too: unless you really, really need other type of backend, JS is the default way to go and the most efficient in terms of code.
If you don't need an specific ecosystem or requirements and you don't mind any language, JS backend is probably 99% the best choice.
1
u/nemec Jul 08 '21
WASM is not backend, is frontend
Well aware. Tens of thousands of coders are already writing code in JS and other languages at the same time, the fact that WASM requires a tiny bit of JS doesn't impact decision making at all when choosing a tech stack.
1
u/DerKnerd Jul 07 '21
I don't think it has Garbage Collection baked-in (yet) and therefore you're restricted to using languages where you handle your own allocation of memory (C/C++/etc.) I
think
GC is coming, but haven't bothered checking.
Languages usually bring their own runtime including GC. So that is not a really big issue.
1
u/jddddddddddd Jul 07 '21
Is it not? I was under the impression that implementing WASM in WASM was pretty costly in terms of processing.
3
u/DerKnerd Jul 07 '21
I don't know for sure, I only used Rust with webassembly but I saw Blazor apps that run pretty fast.
2
Jul 08 '21
Blazor apps that run pretty fast.
it's pretty bad in the only benchmark I know
https://krausest.github.io/js-framework-benchmark/current.html
1
1
36
u/myusernameisunique1 Jul 07 '21
I think people often incorrectly assume that the way most new technologies will be used is directly by the developer. It hardly ever happens this way.
When Websockets first came out everyone was trying to think how it would affect them, but what we end up with in the end is you install some framework and you enable the websockets option and you're using websockets without having to understand what's going on in the framework.
I think the same thing will happen with WebAssembly, a new framework or IDE will come with a setting somewhere 'Use WebAssembly' and you'll tick the option and you'll have WebAssembly as a deployment option.
Really just have to be patient until that framework comes along.