5 ms·
> I mean sure WASM has allowed C, C++ and Rust to run on the web for awhile now but they aren’t typically languages that web developers tend to have a lot of kn
by menaerus 3y ago
> I mean sure WASM has allowed C, C++ and Rust to run on the web for awhile now but they aren’t typically languages that web developers tend to have a lot of knowledge of or interest in learning.
I think that main use case is not for the web developers who already know the tech needed for web development but actually vice-versa. E.g. you're a C/C++/Rust developer and you want to expose your product as a browser service - you transpile it to wasm and with a bit of JavaScript you integrate it into the end service. And that landscape is now expanding to other languages too, namely the ones with the GC.
- pjmlp 3y agoAlready possible with PNaCL and CrossBridge in 2010, but yeah we needed to have it as a standard and delay everything for a decade.
- menaerus 3y agoI don't really know about PNaCL or CrossBridge, web is not particularly my domain but I was just trying to state the obvious advantage about WASM.
- solarkraft 3y agoYou're entirely correct. Non-standard ("proprietary") things tend to not catch on.
- pjmlp 3y agoThe irony is that with ChromeOS taking over the Web it hardly matters.
- deleted 3y ago[deleted]
- comex 3y agoEmscripten has been around since 2012, originally targeting JavaScript. But if you’re comparing to proprietary examples, you could go all the way back to ActiveX in 1996. Or, since today’s news is about Java, you could go back to Java applets in 1995. (At least those were somewhat secure, unlike ActiveX.)
- pjmlp 3y agoYeah, I left those out on purpose, because Java Applets did not support C and C++, although there were later compilers for the JVM, and ActiveX were straight COM x86 binaries.
- PoignardAzur 3y ago> E.g. you're a C/C++/Rust developer and you want to expose your product as a browser service - you transpile it to wasm and with a bit of JavaScript you integrate it into the end service Speaking as someone who worked for two companies that tried to do exactly that, it's not that simple. The "bit of JavaScript" ends up requiring huge amounts of work, and the user experience feels un-browser-like, because you're fitting everything through a canvas element.
- menaerus 3y agoI have almost no exposure to JS but what I have seen so far in WASM projects didn't seem to require that much of a non-usual work but, of course, YMMV. To me the most challenging part seemed to be in the domain of debugging when things would go south because all of the sudden you have to become very intimate with how things work under the hood and across the whole stack: JS -> V8 -> WASM runtime -> Emscripten -> C++. There's not many people capable of doing that job. > user experience feels un-browser-like Perhaps Photoshop is not the classical example but I think it's one of the most craziest ones out there - humongous and extremely complicated C++ codebase consisting of every imaginable optimization and heavy lifting deployed as a WASM "plugin". [1] https://medium.com/@addyosmani/photoshop-is-now-on-the-web-38d70954365a https://medium.com/@addyosmani/photoshop-is-now-on-the-web-3... [2] https://web.dev/articles/ps-on-the-web https://web.dev/articles/ps-on-the-web
- martinald 3y agoYou can leverage normal HTML though? Blazor does this with C#, you don't write it all to a canvas element, you just use C# to modify the html itself, basically replacing the 'react' part of the UI.
- tomhallett 3y agoYes, but it's important to think about the bridge/shim between your application code (the web assembly module) and the host (the browser). If you have a C++ game which draws to the screen with SDL, then you can use a shim to convert SDL calls into html canvas calls [1]. But if a backend engineer wants to compile their java swing application to web assembly, there is a larger impedance mismatch from Java Swing => react html, then from Java Swing => html canvas. If your application is built upon a web framework which already has this translation layer, like Blazor, then the amount of harness/shim-glue code you need to write goes down. 1: https://web.dev/articles/drawing-to-canvas-in-emscripten https://web.dev/articles/drawing-to-canvas-in-emscripten