5 ms·
"Rust the least-painful language" " I’ve been using Rust for a couple of years now and I still don’t really understand lifetimes" Seems like a major pain poin
by Thaxll 4y ago
"Rust the least-painful language"
" I’ve been using Rust for a couple of years now and I still don’t really understand lifetimes"
Seems like a major pain point.
- Shish2k 4y agoIt would be if I ran into it regularly -- but after using the language for a variety of professional and personal projects for a couple of years, this is the only time I’ve actually needed to manually-specify lifetimes since the compiler normally figures it out for me :)
- robocat 4y agoThey are saying rust is painful. Just that they find the other languages even more painful.
- davisoneee 4y agoExcept that they don't really say rust was painful....just that there was one specific moment / aspect that they found tricky.
- pkolaczk 4y agoAs long as you don't get too crazy with references in structures or async code, lifetimes are not going to chase you.
- galangalalgol 4y agoGenerics too right?
- pdimitar 4y agoI know people say that about everything but Rust generics are very readable and do make sense after you understand what problem are they solving. They do look intimidating to start with, admittedly, and I'll concede that's a negative point for Rust. But it does get better if you practice for a bit.
- galangalalgol 4y agoNo I just meant using generics seems to require explicit lifetimes decently often. I don't understand why.
- pdimitar 4y agoNot sure that's the case btw. I have noticed it with some libraries but I've used and crated a fair amount of generics without having to annotate stuff with lifetimes. Lifetimes are necessary when you want to explicitly say "variable X will live just as long as variable Y", or sometimes it's more complex (i.e. you have to specify 2 or more separate lifetimes and then return something that pertains to only one of them) but it's still fairly predictable if you keep it all in your head while coding. Don't get me wrong I still hate it but it's not as terrible as many people make it out to be. It's hard to get into but also very logical and graspable.
- Ar-Curunir 4y agoThe reason it's not a pain would be explained by the rest of the sentence which you omitted: "but thankfully 99% of the time I can avoid them"