3 ms·
Gonna have to hard disagree here. Rust developers straight up opted for obscure, weird, idiosyncratic, non-self-explanitory syntax. '?' doesn't mean anything l
by adastra22 3y ago
Gonna have to hard disagree here. Rust developers straight up opted for obscure, weird, idiosyncratic, non-self-explanitory syntax.
'?' doesn't mean anything like what it means in every other programming language, and it's everywhere. It is so frequently used that you get used to it pretty quick, but it is very not obvious to a beginner.
Obscure #[blah(blah)] attributes attached to nearly every line of code in some places. Do those have meaning? Are they just hints to the compiler? You'd better hit the docs to find out.
Do I need a &mut Option<Thing>, or an Option<&mut Thing>? And how do I get that out, as a `opt.as_ref().mut()`, `opt.as_ref_mut()`, or &mut *opt`? Are these valid? What's the difference? Idk, it's inscrutable.
Rust syntax really, really sucks my friend.
- jstx1 3y ago> Do I need a &mut Option<Thing>, or an Option<&mut Thing>? Follow up to this example: let's say that I don't know the answer, what do I search for if I want to find out?
- adastra22 3y agoMan, I don’t even know. It’s ungoogleable. The only thing that keeps this from being as big an issue as it ought to be is that rustc’s error output is really, really good. Usually it tells you how to fix it.
- orwin 3y agoIt's more of an issue with rust concepts, not syntax. I had the same issue when I wrote lisp the first time (and it ended up being a pretty complex finite state machine). The second part of your question is bad syntax however, I agree (but still, 90% of the unscrutability of rust is caused by its concepts imho).
- deleted 3y ago[deleted]
- zelphirkalt 3y ago> Do I need a &mut Option<Thing>, or an Option<&mut Thing>? That depends on what you want. Do you want the address to a mutable Option of a Thing, or do you want an Option of an address of a mutable Thing? The mental model you have of your code should make this rather clear.
- InsanityBlossom 3y agoI think you just don't need Rust. Your comment suggests that you didn't even try to learn the language or maybe hoped that you'll master it just by looking at it? It's a complex language with unique properties, and it's syntax was carefully crafted towards it's goals - high performance, close to hardware, no runtime, memory safety etc.