News for hackers. Stuff that matters.
Re:Let’s Replace JavaScript with Something Better by krapp on Thursday April 12, 2018 @06:43PM (#16825631)
The problem with that is, no one is going to be writing raw WASM code - it's going to be compiled from another language, which means requiring a compiler toolchain to replace an interpreted scripting language that only really requires a text editor.

For sites which are already using the paradigm of "compiling to javascript" that might not be an issue, but that doesn't cover all the use cases for Javascript.

Other languages can't really occupy that same space until it's possible to, say, embed Lua or Rust source in script tags and just have it work as easily as Javascript does, and have the browser handle compilation and execution entirely.

Re:Let’s Replace JavaScript with Something Better by ihnorton on Tuesday April 17, 2018 @09:14AM (#16857929)
> means requiring a compiler toolchain

If your compiler toolchain both runs on and generates WASM then you’ve removed about 90% of the pain of compiler toolchains. The experience should be on par with something like typescript or one of the ecma compatibility compilers. There’s still potential for classes of issues that would not exist in straight Javascript, but I’d rather debug most of those with browser tooling than gdb.

Re:Let’s Replace JavaScript with Something Better by KyleGalvin on Thursday April 12, 2018 @07:37PM (#16825886)
That's an interesting thought. I didn't mean to suggest anyone code in WASM, but I think I see what you mean.

I have experience embedding lua applications within mobile apps, and it required a fair deal of wiring in C to marshal between java and lua (android) or swift and lua (ios).

To do the same in WASM sounds rather undesirable.

Edit: to finish my thought, I dont see the problem with using a compiler toolchain to create web applications. Can you elaborate on why that isn't a good thing?

Re:Let’s Replace JavaScript with Something Better by krapp on Thursday April 12, 2018 @07:52PM (#16825975)
>Can you elaborate on why that isn't a good thing?

It's not a bad thing per se, but it's added complexity without any obvious benefit if that code is still doing what javascript already does, just as a binary blob, especially for simple uses like glue code around jQuery or the sort of JS running on Hacker News.

Re:Let’s Replace JavaScript with Something Better by steveklabnik on Thursday April 12, 2018 @10:28PM (#16826717)
> To do the same in WASM sounds rather undesirable.

This can be automated though; it's what we've been working on in Rust, and the approach is fundamentally language-agnostic.