Most code running on the web is event-based, garbage-collected, and dynamically typed. In stark contrast, Rust is a compiled language with static type

Rust meets the web - a clash of programming paradigms

submited by
Style Pass
2021-06-14 11:30:03

Most code running on the web is event-based, garbage-collected, and dynamically typed. In stark contrast, Rust is a compiled language with static type- and memory-safety without a garbage-collector. What are the implications for a project that compiles Rust to WebAssembly? I try to answer this question with a fictive story and hands-on code examples.

Today, I tell a tale of a cultural clash. Programming culture, that is. The JavaScript culture on one end, and the Rust culture on the other.

To lay down the necessary foundation, I start by talking about what makes the two ecosystems unique and different from each other. This leads to the suggestion that it might be difficult to write idiomatic Rust code that runs in the browser. I want to find out how viable it is and when it makes sense to use Rust in the browser.

When browsers have first been created, people were very excited. Text and images could be placed and styled with dozens of possibilities. It is a second Gutenberg Revolution, everyone gets access to an infinite amount of information that was previously unreachable. What a great achievement!

Leave a Comment