Re: [rust-dev] Why explicit named lifetimes?

2014-05-22 Thread Michael Woerister
On 19/05/14 20:52, Brian Anderson wrote: On 05/15/2014 09:30 PM, Tommi wrote: On 2014-05-16, at 7:14, Daniel Micay danielmi...@gmail.com 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?

Re: [rust-dev] Why explicit named lifetimes?

2014-05-22 Thread Felix S. Klock II
Michael (cc'ing rust-dev)- On 22 May 2014, at 16:32, Michael Woerister michaelwoeris...@posteo.net wrote: Lately I've been thinking that it might be nice if one could omit the lifetimes from the list of generic parameters, as in: fn fooT(x: 'a T, y: 'b MyStruct) - ('b int, 'a uint)

Re: [rust-dev] Why explicit named lifetimes?

2014-05-22 Thread Jan Klesnil
Hi, On 05/22/2014 04:32 PM, Michael Woerister wrote: Lately I've been thinking that it might be nice if one could omit the lifetimes from the list of generic parameters, as in: fn fooT(x: 'a T, y: 'b MyStruct) - ('b int, 'a uint) instead of fn foo'a, 'b, T(x: 'a T, y: 'b MyStruct) - ('b int,

Re: [rust-dev] Why explicit named lifetimes?

2014-05-22 Thread Michael Woerister
On 22.05.2014 17:54, Felix S. Klock II wrote: Michael (cc'ing rust-dev)- On 22 May 2014, at 16:32, Michael Woerister michaelwoeris...@posteo.net wrote: Lately I've been thinking that it might be nice if one could omit the lifetimes from the list of generic parameters, as in: fn fooT(x: 'a

Re: [rust-dev] Why explicit named lifetimes?

2014-05-19 Thread Brian Anderson
On 05/15/2014 09:30 PM, Tommi wrote: On 2014-05-16, at 7:14, Daniel Micay danielmi...@gmail.com 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

Re: [rust-dev] Why explicit named lifetimes?

2014-05-17 Thread Tommi
On 2014-05-17, at 3:54, Kevin Ballard ke...@sb.org wrote: On May 15, 2014, at 9:54 PM, Daniel Micay danielmi...@gmail.com wrote: On 16/05/14 12:48 AM, Tommi wrote: On 2014-05-16, at 7:35, Steven Fackler sfack...@gmail.com wrote: Type annotations are not there for the compiler; they're

Re: [rust-dev] Why explicit named lifetimes?

2014-05-16 Thread Kevin Ballard
On May 15, 2014, at 9:54 PM, Daniel Micay danielmi...@gmail.com wrote: On 16/05/14 12:48 AM, Tommi wrote: On 2014-05-16, at 7:35, Steven Fackler sfack...@gmail.com wrote: Type annotations are not there for the compiler; they're there for people reading the code. If I want to use some

[rust-dev] Why explicit named lifetimes?

2014-05-15 Thread Tommi
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? ___ Rust-dev mailing list

Re: [rust-dev] Why explicit named lifetimes?

2014-05-15 Thread Daniel Micay
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

Re: [rust-dev] Why explicit named lifetimes?

2014-05-15 Thread Daniel Micay
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?

Re: [rust-dev] Why explicit named lifetimes?

2014-05-15 Thread Tommi
On 2014-05-16, at 7:14, Daniel Micay danielmi...@gmail.com 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

Re: [rust-dev] Why explicit named lifetimes?

2014-05-15 Thread Steven Fackler
Type annotations are not there for the compiler; they're there for people reading the code. If I want to use some function I don't want to be forced to read the entire implementation to figure out what the lifetime of the return value is. Steven Fackler On Thu, May 15, 2014 at 9:30 PM, Tommi