3 ms·
Interesting solution! I like futures, though cancelation has historically been a controversial topic there, too (at least in the JavaScript world; JS promises
by lobster_johnson 10y ago
Interesting solution!
I like futures, though cancelation has historically been a controversial topic there, too (at least in the JavaScript world; JS promises are not cancelable, which is problematic for HTTP requests [1]).
I do like that you guys chose to not make green threads a language-level construct (as Go did with "go" and goroutines), which means you have the option of supporting multiple models, for the programmer to choose according to their particular use case.
[1] https://github.com/whatwg/fetch/issues/27 https://github.com/whatwg/fetch/issues/27
- steveklabnik 10y agoCancellation falls out of the model: you drop the future, and it Just Works. (drop being the regular old Rust destructor stuff, which happens when it goes out of scope, or when you call std::mem::drop.) Yup! The danger there is that the ecosystem may fragment, however, basically everyone is rallying around tokio, including the other people who were working on similar libraries, so in practice, this should be fine.