obviously just my opinion, please don't dox me
over the summer i got into rust
not of my own volition, but because my friends said it was a great tool for building CLIs
and i was thinking of building a CLI for automatically running, checking, and diffing
usaco + cf solutions
so like an absolute buffoon, i went along with it for whatever reason
the very next day, they just disappeared and left me,
the only one without any prior rust experience, to rot in backlog hell
"well piss", i thought, "but frick it, i made a goddamned commitment and i'm going to do this"
what a mistake that was
god, i hate this cheeky little crab with a vengeance
rust starts out pretty fine, actually
(btw if anyone's curious i learned it from here)
alright, the exclamation mark seems a bit weird, but other than that it's just a standard language right?
right?
but anyways, rust does has some pretty neat qol stuff, like:
yeah, pretty cool!
but just as you think it's all fine & dandy, and think you're ready to take on functions:
```rust fn bruh_moment(x: String) { let y = x; } fn main() { let x = "bro...".to_string(); // <- also very stupid bruh_moment(x); dbg!(x); } ```rust just punches you in the face with THIS:
```rust error[E0382]: use of moved value: `x` --> src/main.rs:8:10 | 6 | let x = "bro...".to_string(); | - move occurs because `x` has type `String`, which does not implement the `Copy` trait 7 | bruh_moment(x); | - value moved here 8 | dbg!(x); | ^ value used here after move For more information about this error, try `rustc --explain E0382`. ```WHAT THE HECK??
TURNS OUT, if you just define a raw type (other than primitives), the function TAKES OWNERSHIP of the value and you just CAN'T USE IT AGAIN
but at least in this sample code snippet, you can fix it by doing this:
```rust fn bruh_moment(x: &String) { let y = x; } fn main() { let x = "bro...".to_string(); bruh_moment(&x); dbg!(x); } ```thus embodies the essence of rust:
it's memory safe, but at what cost?
anyways, i decided to practice rust by redoing advent of code 2015, which i'd previously done in python
(you can find the src
here)
and thus began a series of interactions with the rust compiler which mostly went like this:
and i feel like that took away half my sanity
it's not just the ownership system- even simple stuff like converting to an integer is kinda convoluted
```rust let i = "1".parse::<i32>().unwrap(); // bruh just give us a global function or something ```in fact, i've had so many problems with rust's "i'm not like other languages" style that i've compiled a list of grievances (very long!!!)
anyways, my main problem with rust is the sheer anxiety it gives you through how many things it makes you consider when writing your code
actually i wouldn't say problem, more like just it's different, and it's gonna take a hell of a long time for me to get used to it.