▲ | vlovich123 5 days ago | ||||||||||||||||||||||||||||||||||||||||||||||
I really don’t understand this argument. If you force the user to transfer ownership of the buffer into the I/O subsystem, the system can make sure to transfer ownership of the buffer into the async runtime, not leaving it held within the cancellable future and the future returns that buffer which is given back when the completion is received from the kernel. What am I missing? | |||||||||||||||||||||||||||||||||||||||||||||||
▲ | Inufu 5 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||
Requiring ownership transfer gives up on one of the main selling points of Rust, being able to verify reference lifetime and safety at compile time. If we have to give up on references then a lot of Rusts complexity no longer buys us anything. | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
▲ | newpavlov 5 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||
The goal of the async system is to allow users to write synchronous looking code which is executed asynchronously with all associated benefits. "Forcing" users to do stuff like this shows the clear failure to achieve this goal. Additionally, passing ownership like this (instead of passing mutable borrow) arguably goes against the zero-cost principle. | |||||||||||||||||||||||||||||||||||||||||||||||
|