September 24, 2026
Threads with shared mutable objects will make JavaScript worse: coding agents struggle even with Rust
On Sep 24, Jose Valim called threads with shared mutable objects a nightmare for developing, maintaining, and debugging JavaScript. In his experience, coding agents struggle with safe shared memory even in Rust.

José Valim
@josevalim
If by threads with shared objects you mean threads with shared *mutable* objects, writing, maintaining, and debugging that on top of JavaScript's event loop will be a nightmare even for coding agents. In Rust, data ownership and the type system are specifically designed to make concurrent access to shared memory safer. In my experience, coding agents still struggle with it. A huge body of existing code assumes that synchronous JavaScript within an agent runs to completion. If ordinary objects suddenly gain concurrent access, two handlers in different threads could see and modify the same object at the same time. Code that is safe today because two synchronous operations cannot interleave would suddenly require synchronization. This is probably why existing JavaScript concurrency mechanisms typically use isolated object heaps and message passing, or explicitly shared memory through SharedArrayBuffer, rather than making arbitrary JavaScript objects mutable concurrently. I think changing such fundamental properties of the language would make it worse, not better. Strict typing and AoT compilation are beneficial.
JavaScript was never designed for the server. If that doesn't change soon, JavaScript on the server will be replaced by Rust. The fix needs to happen in the engine. Sound types. Ahead-of-time compilation. Threads with shared objects.
· 14K views
On Sep 24, Jose Valim called threads with shared mutable objects a nightmare for developing, maintaining, and debugging JavaScript. In his experience, coding agents struggle with safe shared memory even in Rust.
Valim supported strict typing and AoT compilation, but called threads with mutable shared objects a step backward.
Source
