Hello. Rust is very cool language and it is easy and flexible, because it is more abstract by ideas from functional programming, but rust has almost just one but - explicit lifetimes. Very often my ideas brake on this lifetimes.
That's why they have confusing syntax and they make code dirtier.
Okey, I can explain and understand case
struct Foo<'a>{
field:&'a i32,
}
impl<'a> Foo<'a>{}
But what mean when we have?
struct Foo<'a,'b>{
field1:&'a i32,
field2:&'a i64,
}
or
fn foo<'a,'b>(s:&'a Foo<'b>) -> Foo<'a>
or
struct Foo<'a,'b,T:Trait + 'b>
or what is should do if i want 2 fields with same generic but different lifetimes?(I do not understand more then one lifetimes>
struct Foo<'a,'b,T1:Trait<'a>+'a,T2:Trait<'a>+'b>{
field1:T1,
Field2:T2,
}
and this instead
struct Foo<T>
and how about this:
struct Foo<'a,'b,T:Trait<'a>+'b>{
prev:Option<&'a Foo<'a,'b> >,
value:&'b T,
}
Often I am scared to recommend rust - lifetimes are too problematic.
I am sure, that where are only a little rust developers, who understand lifetimes so good und who do nod spend 1-3 hours for 20 lines of code with lifetimes. For others this is way to shot in leg.
I am sure that almost nobody needs them. As for me, this is just new routine troubles in coding. I also heard discontent about it.
This is really good way to spend more than one day. This is only thing I need to ask about help in rust! This is very long minus for industrial development. A lot of programmers have not heard about closures and tuples, but this lifetimes make rust the most difficult language I know. Just because you can write something with c++ and it will works, but rust will make suffer with lifetimes. Explicit lifetimes is bad idea. Please, remove them as soon as possible or make it optional or change lifetimes syntax(for example like type A:Trait in traits, and > < for lifetime comparison.