4 ms·
> Basic stuff like named return values no longer work. If Rust hypothetically wanted to add named return values, I think the way they'd do it is have the compi
by oconnor663 8y ago
> Basic stuff like named return values no longer work.
If Rust hypothetically wanted to add named return values, I think the way they'd do it is have the compiler check that all codepaths through the function initialize the returns. In general rustc is happy to let you declare uninitialized variables, and even partially initialize them field-by-field, as long as it can prove to itself that everything's fully initialized by the time you read it.
- SamReidHughes 8y agoThis won't work the way Go does it, or else you end up with fiddly little rules about when you're allowed to take addresses of variables and such.