Re:Rust is Software's Salvation
by allengeorge on Thursday December 29, 2016 @07:26PM
(#13281488)
Honestly, I found dealing with generics worse than the borrow checker. Since the compiler wants everything to be sized, code that I think should work (i.e. using generics and traits) will sometimes just not compile. In fact - I'm dead in the water facing an issue like that right now. That is, by far, the most frustrating thing in using Rust.
Re:Rust is Software's Salvation
by burntsushi on Thursday December 29, 2016 @07:29PM
(#13281508)
Can you describe the issue? Perhaps someone can help.
I don't know if it helps you or not, but you can specify that a type parameter need not be sized with the ?Sized bound. e.g., The `Path::new` constructor is defined as `fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path`. This means `S` can, for example, be `str`, which is an unsized type.
Re:Rust is Software's Salvation
by allengeorge on Thursday December 29, 2016 @07:40PM
(#13281570)
Thanks guys - much appreciated. I'm on my mobile in another country, so, can't post a link right now - but I will later tonight when I've WiFi.
BTW - this reaction is why I continue to work with Rust; the community is awesome!
(Dealing with trait objects and generics...less so)
Re:Rust is Software's Salvation
by steveklabnik on Thursday December 29, 2016 @07:28PM
(#13281499)
Have you asked for help on one of the various forums? If something is leaving you dead in the water, I'd like to help you fix that.
Within a couple weeks you will get the hang of what the borrow checker can actually handle and you'll mostly not have problems except when you are actually making a genuine mistake.