Hacker News new | ask | show | jobs
by eropple 3045 days ago
If you are a junior frontend developer, WASM probably just doesn't mean much to you, and probably won't. You'll use it, wrapped by a JavaScript facade, to do some performance-sensitive stuff. (Some folks are rubbing their hands together about the possibility of using the DOM in another language and not writing JavaScript; this will eventually happen, but I strongly doubt mainstream frontend development will go that way in the reasonably near future.

I don't really see why you should be intimidated by it any more than a Java programmer who sees JNI barf once in a while should be intimidated by C. If you're that interested, all you really have to do is learn a normal, natively-compiled language. Which would be wise anyway--nobody serious about the field should only know one language, JavaScript or not. Then you can learn how to compile down to WASM (it's rarely difficult) and just go from there.

3 comments

It's intimidating because the tooling is very immature. Compiler and debugger support is not at the level of Java or C.
> Compiler and debugger support is not at the level of Java or C.

WASM is more of a compiler target, not a language at the level of C or Java: its something you'd compile to from C.

That doesn't forbid WASM to have a nice graphical debugger, like most CPUs have.
WASM can already be debugged with the browser-integrated debuggers, source maps can map back to the original files.
> Some folks are rubbing their hands together about the possibility of using the DOM in another language and not writing JavaScript; this will eventually happen

Sadly WASM doesn't help here at all due to lack of way to interact with the GC. Not only lack of finalisers but that having two GCs doesn't work. I learnt this 2 times over the hard way.

For something today, look to fengari: https://fengari.io/ . It implements a VM in javascript, reusing the javascript garbage collector, which means that you get seamless DOM interaction.

GC interaction is not needed for DOM stuff. That was originally the case, but the "host bindings" proposal lets it shed that dependency. I pasted a link downthread.
In time. Model the WASM code as a WebWorker, use the DOM like you would in React. A semantic level shadow DOM in WASM is lightweight.

WASM is a beautiful baby universe, hatched from a messy past.

Yeah, I've been working on python and java for sometime but it still boils down to js thinking for me.

Thanks for explanation though, I'm not intimidated of it taking my job as much as I am the wide scope of the thing. Seems massive!

I dunno. It's no more massive than most other computing environments. JavaScript is an aberration in the way it's structured. This is certainly a matter of perspective; I tend to think that starting with a restrictive environment like JavaScript (and don't get me wrong, I like JavaScript and write a decent bit of it every day) makes the cage look like the world. Pedagogically speaking, I worry about JavaScript being somewhat damaging...but, whatever.

Anyway, WASM is just trying to remove the restrictions on a strict environment (that's why it's called Web Assembly, yeah?). The example that floated to mind--you've been writing Java? This[1] is written in Clojure, but there's no reason you can't get this wacky in Java. (Not that you should.)

[1] - https://aphyr.com/posts/341-hexing-the-technical-interview