Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
RememberMe1404323dStrings are pretty complex in pretty much every language with manual memory management.
If you thought strings were simple in C/C++, wait till you have to work with a ton of them in a large scale application.
asgs853723dReassigning immutes is disallowed in all the languages
yellow-dog4718623dWhile i think rust sucks ass and id much rather use c
1) simple scoping issue, at least the error is explicit
2) this usually happens when you try to modify an immutable thing in place, which makes sense
The real mindfuck is when you start using libraries and half of them have mutable variables and the other half only uses references.
None of those errors are specific to strings though, they're lifetime/mutability errors which would just as well apply to other values. But I get your frustration.
It takes a bit to get used to Rust memory trickery... but when it clicks, it's like "well duh, that just seems like a good practice". Rust just points out things which could actually cause errors in other languages as well.
But it does take a few weekends of stabbing with a rusty knife at some pet projects while occasionally throwing objects through your room, before you get used to it.
Geoxion56022dIn C you just have char*
This can be many kinds of string! It only seems like one. It can be String, &str, &'static str, OsString and many more.
I'd rather have them as separate types because then at least the compiler tells you when you have a bug instead of finding out in production.
Also, don't be afraid to clone! Other languages do this implicitly
@Geoxion And in C you have no idea who owns that little pumpkin patch of memory.
Rust multithreading & async is like immersing yourself in a godly S-tier chocolate fountain and thinking "so this is what sweet warm dessert sauce feels like when it flows over my balls".
Sorry, be right back, have to masturbate a bit.