Hacker News new | ask | show | jobs
by bluejekyll 3280 days ago
I'm really surprised to read an article like this that doesn't mention Rust. The reason is that I find it hard to believe that developers will want to move to unsafe languages like C/C++. Many of the other languages mentioned require runtimes, runtimes that will need to be built on top of webassembly.

Rust doesn't have any of these drawbacks, is runtime free, and can already target webassembly. Given that both of these technologies are young, webassembly even younger, there's no big argument for legacy code in this context, which means adopting something new would be fine, and good in this case because of the safety guarantees.

Anyway, a great intro in general, but for anyone looking at getting into this, I highly recommend checking out the Rust tutorials, like this one: https://medium.com/@ianjsikes/get-started-with-rust-webassem...

3 comments

WebAssembly is in a large part about re-using vast quantities of existing C/C++ code in the browser.

C++ will dominate in that space over Rust for the same reason it'll dominate in all other spaces: the amount of existing C++ code and the number of existing C++ programmers will always dwarf the amount of Rust code and Rust programmers.

Even if Rust was uniformly 10-20% better than Rust, economics dictate that for most people it'll make most sense to continue with C++ than rewrite thousands or millions lines of code in C++ or embark on months-long retraining of large number of programmers, some of which will not be happy about going from being proficient C++ programmers to beginner Rust programmer.

And that's why we don't need to mention Rust when writing about WebAssembly. At this point in time it's immaterial to the subject.

I tend to agree with you in the context of porting existing C/C++ code to the Web is going to follow exactly the pattern you mention.

But, for new software, with no previous dependencies? The stdlib in Rust is decent, and the ecosystem is growing quickly. For new projects, I do think these will help in it's adoption in a new environment like WebAssembly, but we shall see!

For me Rust is a deja vu experience, in a certain sense.

I started to use C++ around 1992, on MS-DOS, as my next loved programming language after Turbo Pascal. Never saw any value in plain C, other than writing code unsafer as straight Assembly (Assembly has less UB than C).

Have taken part in C vs C++ flamewars on Usenet since those days, only to see C++ finally overtaking C in many fields in the last 10 years.

In some fields, like embedded programming, C still reigns over C++.

So while I look forward to have my managed languages, OSes and performance critical libraries written in a safer language, my life experience tells me it will take a few decades to achieve the same level of market adoption.

By no means do I believe it will overtake these other languages quickly. But one huge benefit that Rust has over these others is this idea of "fearless programming". Watching Ruby Devs jump into Rust, fight the compiler for a bit, but then have a blazing fast app with some very detailed systems level interaction, is amazing. On top of that, it never segfaults!

Jumping into C and C++ is in my own experience, much more difficult. All of the complexity of those languages disappears into the Compiler in Rust. I think the big thing here is that Rust can appeal to many developers from all walks, not just those of us who've spent years or decades with Assembly/C/C++.

I agree, but also feel a bit sorry for Ruby devs, in the sense that they could have had that experience with Dylan or even with Apple's short love with a Ruby AOT compiler (which eventually became RubyMotion), while staying in Ruby.
Rust's compile-time safety guarantees are a lot less appealing if the generated code runs ins a sandbox anyway. If the C/C++ code compiled down to wasm goes haywire it is not a security concern, 'only' an inconvenience for the user.
I mean, security issues are just a class of bug. Just because the sandbox keeps you for causing more damage when you stomp on yourself, doesn't mean there's not value in not stomping on yourself at all.
Rust is a great language, but it appeals to a very specific set of engineering goals and a specific type of programmer who wants a lot of control while also wanting strong guarantees. So far, the web has provided neither. So for this reason, I think Rust adoption on the front-end will be slow, but still meaningful.