News for hackers. Stuff that matters.
Re:Building a web application with Rust and WebAssembly by root_axis on Wednesday June 15, 2022 @09:33PM (#31761617)
> why would I use Rust and Web Assembly

Why not? It's a fast, general purpose programming language with a solid type system. The article is a programming tutorial, it's not trying to persuade you to rewrite your employer's web stack in rust.

> but is starting with the highest level of complexity a good idea

Complexity is in the mind of the beholder, if you work with rust often, this is a couple steps above a "hello world" in terms of complexity. Besides, anything that goes beyond string templates and jquery is too complex according to the zeitgeist.

> And the code example puts mark up directly inside Rust files… why

This is a pretty common approach to "component" style web development, there are quite a few motivations for this but the primary advantage is that it causes markup elements to become first-class entities within your code, allowing your view composition to be checked by the compiler as well as allowing you to design your own reusable markup elements that fold up application level concerns. It's also nice when your views have lexical access to your application state variables so you don't have to pre-render a big string template and interlace it with an explicit map of serialized parameters - it's very nice when the compiler lets you know a view simply cannot display the type of data you're trying to shove into it rather than rendering a broken looking page.

There are no comments on this comment yet.