The title should include "multi-threading" with "tiny binaries" also being of interest. Merely TS with borrow-checker makes no sense at all (or makes for good click-bait--it got me :-)
That sounds like the easiest way to implement it. Giving ownership to threads and scheduling coroutines on them is unnecessarily complicated, given that a single coroutine can only be running on one thread at a time.
In Rust, unique ownership and borrowing eliminate defensive coding: you never need to copy "just in case", because the type system makes it clear who can modify what and when.
Elimination of unintentional shared mutable state is generally helpful. It's not just about bare-metal no-GC performance, but helps document and enforce data sharing contract between libraries and their users.
8 comments
[ 4.3 ms ] story [ 26.6 ms ] threadJs is mainly single threaded.
In Rust, unique ownership and borrowing eliminate defensive coding: you never need to copy "just in case", because the type system makes it clear who can modify what and when.
Elimination of unintentional shared mutable state is generally helpful. It's not just about bare-metal no-GC performance, but helps document and enforce data sharing contract between libraries and their users.
> Note that this does not aim to be compatible with TypeScript and JavaScript libraries instead