Re:Rust needs a web framework for lazy developers
by WuxiFingerHold on Monday October 07, 2024 @07:16AM
(#41764868)
Interesting, great example. This kind of compile time safety can't be achieved without borrow checker, I guess? I'm now thinking hard if there's some type magic similar to the exhaustive checks for Typescript discriminated unions ("kind satisfies never" checks in switch statements).
Re:Rust needs a web framework for lazy developers
by kaoD on Monday October 07, 2024 @07:29AM
(#41764942)
I've been trying to come up with a similar pattern in TS many times but I think you cannot do this because all types in JS (and thus in TS) are (1) aliasable by just binding them and (2) only passed by reference (including `this`).
But TS has so many dark magical patterns that I'm still hoping to be proven wrong.
A simple example of the (many) things you can't do in TS:
Try doing that without a runtime crash in TS. Super useful pattern for state machines (which are the building block of computing).I miss more features of Rust in TS that features of TS in Rust. All the time.