3 ms·
Yes, but it requires a special call site (transitively, all the way up the stack) that permits the interleaving, and so cannot sneak into existing code that mig
by pron 5y ago
Yes, but it requires a special call site (transitively, all the way up the stack) that permits the interleaving, and so cannot sneak into existing code that might implicitly assume no interleaving.
- gpderetta 5y agobut good old callback-based code still allows for interleaving and AFAIK JS doesn't require any callsite allocation for that.
- pron 5y agoIt does not allow for interleaving. Interleaving means that state can change in the same subroutine.
- gpderetta 5y agoWhat I mean is that subroutine can observe its own state being changed even after a call of a non-sync marked function if that function directly or indirectly calls into a closure closing over that subroutine state. I.e. IMHO async offers very weak reentrancy guarantees that are better enforced via other means (rust-like lifetimes, immutability annotations, atomic contructs, etc).