News for hackers. Stuff that matters.
Re:Rust needs a web framework for lazy developers by throw10920 on Sunday October 06, 2024 @10:04PM (#41762113)
> Shared mutable state is a problem even in single threaded code (for example, modifying a collection you're iterating over)

...which is an extremely rare source of bugs. The vast majority of errors caused by shared mutable state are related to concurrency.

> usually

So, not always. That is - TypeScript's type system contains features that Rust's does not have.

Re:Rust needs a web framework for lazy developers by miki123211 on Sunday October 06, 2024 @11:41PM (#41762578)
JS has concurrency (but not parallelism) despite being single-threaded, though.

If you ever put an await anywhere in your code, an arbitrary amount of random stuff might run between the time you await and the time the awaiting finishes.

Same applies to older mechanisms like callbacks and promises.

Race conditions are more rare there because as long as you aren't doing any IO, there is indeed no concurrency, so you can't e.g. get two threads trying to increment a single variable at the same time. They can still happen, though, especially if you accidentally do a partial change to an object, put it in an illegal state, and do IO before you finish that change.

Re:Rust needs a web framework for lazy developers by fallingsquirrel on Sunday October 06, 2024 @10:21PM (#41762195)
> which is an extremely rare source of bugs

Confidently asserted, but very debatable.

> The vast majority of errors caused by shared mutable state are related to concurrency.

Concurrency, like async-await, you mean?

> TypeScript's type system contains features that Rust's does not have

Sure, and likewise Rust's type system contains features TypeScript's does not have—for example, just try expressing anything close to traits with TS's type-erased generics. Since the feature sets aren't the same, I suppose it's a matter of opinion which type system is preferable. But I know which one is more helpful for me for sure (especially considering the aforementioned soundness issues).

Re:Rust needs a web framework for lazy developers by dymk on Sunday October 06, 2024 @10:27PM (#41762236)
> which is an extremely rare source of bugs. The vast majority of errors caused by shared mutable state are related to concurrency.

Simply so untrue I’m not going to elaborate further