Skip to content

Comment on Show HN: Sauron – A web framework in Rust that adheres to the Elm architectureparent

Comments

The main issue is that jsx can contain both mutable references to a variable and immutable references. For example <div onClick={() => count = count + 1}>{count}</div> contains both a mutable reference to count and an immutable reference. Thus, the naive way of storing this in a single struct will fail. The use of the elm architecture (where the onClick handler returns a message, instead of directly updating count) side steps the complicated borrow-checker issues.

It is certainly possible to get around this with the proper procedural macro, but it is not easy, and will never be as "magic-free" as people want.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.