Thanks for the clarification. I would be interested to read more blog posts about further details of this topic.
jb On Sun, Jan 27, 2013 at 4:46 AM, Niko Matsakis <[email protected]> wrote: > Hi, > > You are interpreting it correctly. I don't have time at the moment to write > up an example where multiple independent lifetime parameters would be > required, but it is certainly true that this would be very unusual. In any > case, I have several examples that require two lifetime parameters to be > done most naturally, but none that require three, and I'll try to write them > up (perhaps in a blog post) over the next few days. The main thing is that, > today, we are limited to one---it is *almost* always enough, but not quite, > which is why I'd like to generalize to multiple for advanced uses. > > > Niko > > > > James Boyden wrote: >> >> Upon re-reading my message, I realised I could have explained >> my source of confusion better. So, if I may clarify my question: >> >> If `B<'c, 'd, 'e>` is intended to be equivalent to what's currently >> written `B/c/d/e`, does this mean that struct B would be declared >> something like this: >> struct B<'X, 'Y, 'Z> >> ? >> That is, a template with 3 independent lifetime parameters? >> >> In which case, what would be a hypothetical example which might >> require 3 lifetime parameters? >> >> I can understand the purpose of a single lifetime parameter that >> corresponds to the lifetime of the struct instance, such as in the >> example: >> struct StringReader<&self> >> but I can't think of an example involving 3 independent lifetime >> parameters at the struct definition level. >> >> Or have I misunderstood what `B<'c, 'd, 'e>` is meant to mean? >> >> Thanks, >> jb >> >> >> On Sun, Jan 27, 2013 at 1:26 AM, James Boyden<[email protected]> >> wrote: >>> >>> On Thu, Jan 24, 2013 at 10:00 AM, Niko Matsakis<[email protected]> >>> wrote: >>>> >>>> The slashes are visually hard to parse, I think everyone agrees. >>>> Imagine >>>> this: `&a/B/c/d/e`. That would be a legal type under that proposal and >>>> I >>>> think it's pretty darn confusing vs `&'a B<'c, 'd, 'e>` >>> >>> Hi, >>> >>> This is a very interesting discussion. I'm also new to the concept of >>> lifetime parameters, but as a frustrated longtime C++ programmer, I >>> appreciate the concept. >>> >>> Unfortunately, having studied these pages: >>> >>> http://static.rust-lang.org/doc/tutorial-borrowed-ptr.html#returning-borrowed-pointers >>> >>> http://static.rust-lang.org/doc/tutorial-borrowed-ptr.html#named-lifetimes >>> >>> http://smallcultfollowing.com/babysteps/blog/2012/12/30/lifetime-notation/ >>> >>> http://smallcultfollowing.com/babysteps/blog/2013/01/15/lifetime-notation-redux/ >>> >>> I still find myself no closer to understanding what `B<'c, 'd, 'e>` >>> would practically mean, nor how it would be realistically used. >>> >>> Would you be able to clarify? >>> >>> Thanks, >>> jb > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
