On 16/05/14 12:14 AM, Daniel Micay wrote: > On 16/05/14 12:10 AM, Tommi wrote: >> I was just wondering, why do we have to explicitly specify the lifetimes of >> references returned from functions? Couldn't the compiler figure those >> lifetimes out by itself by analyzing the code in the function? > > Type inference is local to functions, so it couldn't do that. It would > be impossible to have libraries if inference needed to be global across > the entire program, and the errors would be *signicantly* harder to > understand as they would span across countless functions. > > The named lifetimes draw a boundary where your intuition is checked, and > the errors end up comprehensible by a mere human like myself.
to a mere human* (see? if only my brain could have a bug fix release)
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev