3 ms·
+1 I don't have the time to shepherd this RFC (or something similar), but I really wish that the whole Async ecosystem was built on something less error prone
by yazaddaruvala 4y ago
+1
I don't have the time to shepherd this RFC (or something similar), but I really wish that the whole Async ecosystem was built on something less error prone / magic-y than ThreadLocalState.
Its not ideal to ever have any "hidden" functionality like auto-propagation, but it would be way better than the current state of async Rust.
https://github.com/rust-lang/rfcs/issues/2327 https://github.com/rust-lang/rfcs/issues/2327
- oconnor663 4y agoI could be wrong, but I don't think Rust futures/tasks rely on thread-local storage anymore. Some early iterations of the feature did, but I think that was replaced with an explicit argument to the poll() function before stabilization. That said, the typical async/await syntax makes that invisible, so it definitely does feel a lot like TLS.
- gpderetta 4y agoIf I understand correctly, Autopropagators are basically implicit parameters , a.k.a typed dynamic scoping, which is exactly what you need to solve this problem. In fact the equivalent Scala functionality is mentioned in the issue thread. They might be confusing but they are probably a million time better than actual mutable globals.