this post was submitted on 27 Jun 2023
46 points (97.9% liked)
Rust
5963 readers
10 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I've done some elixir so pattern matching and functional programming was pretty familiar but yeah, borrowing took me actually reading about it rather than going "I can just figure this out" before I was like "Oh, that makes sense."
And yeah, I remember the first time I encountered the ? operator in some example code I was like WTF?!??! How do I search for THAT?
Having programmed in C, I got the ownership model quite fast. I just think of it as "is this function going to do an implicit free on return", if not then it should just borrow it. And for C, you already had to think of ownership, just that it was not enforced in any way in the language... if you messed up the ownership to either got a crash or leak.