Live data from Hacker News

JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

hacks.mozilla.org

11–20 of 79 posts

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#11
post #7
post #3

> Faster-than-JS DOM performance ... > The wasm-bindgen code generation has been designed with the future host bindings proposal in mind from day 1. As soon as that’s a feature available in WebAssembly, we’ll be able to directly invoke imported functions without any of wasm-bindgen‘s JS shims. Sweet. Once again, Rust team knocking it out of the park.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

>Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday?

Erm... PSA: Rust isn't the only language that is compiling to WASM.

I'm glad for Rust developers (How exciting is for them to be able to target WASM), but what is really exciting is to have alternatives; even more exciting if they have nothing to do with javascript.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#12
post #7

Earlier quoted context omitted.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

Rust is also still very far from having eaten any significant chunk of C.

Do you see any reason why it won't eventually do so?

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#13
post #12

Earlier quoted context omitted.

Rust is also still very far from having eaten any significant chunk of C.

Do you see any reason why it won't eventually do so?

Even if it is objectively better in every way (not saying it is, only going for the most extreme end point for purposes of making a point) it is not guaranteed to replace C. Too many people have invested too much time mastering C and learning to deal with its quirks to simply give it up.

There may come a day where basically 0 new C projects are made. I do not think that will be in my lifetime. And I say that as someone with near 0 investment in the language but intends to get more serious about learning rust in the near future.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#14
post #6

Earlier quoted context omitted.

At our local Rust meetup we have someone who's gotten WASM running on a microcontroller, so maybe that's not entirely unrealisitic. :P

Wait, who was that?

Maybe it was this guy: https://github.com/pcein/embedded-rust-workshop

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#15
post #12

Earlier quoted context omitted.

Rust is also still very far from having eaten any significant chunk of C.

Do you see any reason why it won't eventually do so?

I mean it might eventually happen but currently hardware support, vendor support, also all major Unix operating system implementations are written in C and the maintainers don't look like they will change anytime soon. Also C has lot's of inertia behind it.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#16
post #7
post #3

> Faster-than-JS DOM performance ... > The wasm-bindgen code generation has been designed with the future host bindings proposal in mind from day 1. As soon as that’s a feature available in WebAssembly, we’ll be able to directly invoke imported functions without any of wasm-bindgen‘s JS shims. Sweet. Once again, Rust team knocking it out of the park.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

Rust isn't the only player here. Kotlin I think does webasm already. And I think Java and C# will also jump on the bandwagon eventually.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#17
post #7

Earlier quoted context omitted.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

>Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? Erm... PSA: Rust isn't the only language that is compiling to WASM. I'm glad for Rust developers (How exciting is for them to be able to target WASM), but what is really exciting is to have alternatives; even more exciting if they have nothing to do with javascript.

"Erm... PSA: Rust isn't the only language that is compiling to WASM."

No, but Rust will still be sitting in a sweet spot, having many of those characteristics I named. For instance, Python compiling to WASM may be useful, but it won't have any of those advantages. Python running on WASM isn't hardly a threat to JS at all, because it won't do anything JS can't. Rust will conceivably be able to in the near term, and as I said, if it takes off and the browsers start adapting to statically-typed functions running in WASM the gap could open even more.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#18
post #10
post #7

Earlier quoted context omitted.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

Is JS even the speed problem or is it banging on the DOM all the time?

[deleted]

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#19
post #16
post #7

Earlier quoted context omitted.

"Faster-than-JS DOM performance" That will be when the clock starts ticking on Javascript. Who'da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday? I'm not saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily could switch to Rust. But the framework war will take a very interesting turn if Rus…

Rust isn't the only player here. Kotlin I think does webasm already. And I think Java and C# will also jump on the bandwagon eventually.

Rust has some significant advantages compared to languages like Kotlin, Java, and C# here. A really big one is binary sizes. To get those languages to work, you have to ship the entire runtime. For example, see https://www.infoq.com/news/2018/01/mono-cs-webassembly

> (the "hello world" example is 10 megabytes)

The "hello world" example in Rust is ~100 bytes.

Some applications and some people can pay these costs, it's true. But tiny binaries is quite appealing. It's even part of the reason that WebAssembly was created in the first place.

Re: JavaScript to Rust and Back Again: A Wasm-Bindgen Tale

#20
post #12

Earlier quoted context omitted.

Rust is also still very far from having eaten any significant chunk of C.

Do you see any reason why it won't eventually do so?

The other question is whether there actually is a reason that it will eventually do so. I personally have my doubts. C has found that perfect sweet spot between not getting in the way of doing things and running on almost any platform. Rust still has to achieve that status and judging from other competitors like C++/D it seems hard to get to that point. Heck, even Java was advertised as systems language on Java CPUs for a while.
Post reply on HN