5 ms·
It's not modern languages, it's Rust specifically - they didn't optimize for readability and ended up with a language that's hard to read.
by jstx1 3y ago
It's not modern languages, it's Rust specifically - they didn't optimize for readability and ended up with a language that's hard to read.
- ilyt 3y agoNot really. Rust is plain hard and complex. There is only so much you can simplify that. Like, you can make jet fighter easier by adding ways to automatically make some things so pilot doesn't have to do all the steps (like say Rust does with some of the memory management), but it will never be as easy to fly as it is to drive a bicycle, still need to learn how everything works and what does what
- jstx1 3y agoProgramming simple things in Rust is less readable than programming the same things in other languages - and you can directly point at the language design as the root cause for this. I'm here doing things like creating an object, iterating over some structure, building a simple function, reading or saving some data, making a small REST API - and while I'm doing these things I have to work with complex syntax and language semantics because the same language also caters to use cases that have nothing to do with the thing I'm working on.
- adastra22 3y agoGonna 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.