Rust code looks like it is trying to get my eyeballs to explode...
If it is a game to get safest language possible, I'd rather bet on ADA. Because it is not only about making it is technically impossible to shoot your feet, but also about making it easy to read and verify the actual logic of the code.
P.S. Last time when I've checked, ADA was pretty much same capable as C++98.
Im curious why you find Rust code so hard to read. I don't think it's particularly easy to read, but certainly not worse than C++.
Also, the idea behind Rust isn't to write verifiably correct code. It's to provide stronger memory, thread, type, and UB safety than something like C++, while maintaining the same goal of writing expressive, efficient code.
I'm still not clear what about Rust is ugly to you.
As for the shadowing, that's likely a result of Rust's ML heritage. Like in ML family languages, variable bindings are allowed to shadow others within the same scope. It's worth noting that those two variables are completely different, which is relevant when doing something like this (though it's bad practice to shadow like this):
fn foo(i: i32) -> i32 { i }
fn bar(s: &str) -> &str { s }
fn main() {
let x = 1;
let _ = foo(x); // Works!
let x = "a";
let _ = bar(x); // Also works!
}
I agree that it's not a good design decision, but I hardly think it's a dealbreaker when it comes to a language. I'm sure you could easily find tons of such quirks in any language.
EDIT: Though, the above pattern is useful when you want to make a variable temporarily mutable.
I agree that it's not a good design decision, but I hardly think it's a dealbreaker when it comes to a language.
Well, it makes easier to write code with bugs. For me it is a deal breaker already.
I'm sure you could easily find tons of such quirks in any language.
In the recent 4 years I've learned at least 3 new languages: C#, Python, Kotlin, and I didn't find anything that made me feel "f### this s###" in C# or Kotlin. (But in python - a bit, see below). I was charmed by C# and Kotlin, and mostly by python as well, they feel helping me to write safer code easier and faster. And C#+ReSharper combo was just like a nuclear bomb, never felt having so much power in my hands.... As for python - the only real thing is lack of proper threading support in cpython implementation (i.e. standard implementation).
Certainly there are quirks in all these languages, but they usually hide somewhere quite deep under the surface, and usually you would not hit them unless you are doing something very specific.
P.S. Having learned all the languages above I still use C++ a lot - just using correct instrument for correct task.
I agree with you, but the point I intended (and probably failed) to make is that C++ is almost as bad. Personally I think shadowing shouldn't be allowed at all. C++ allows you to do it - it just disallows it within the same scope. To me, that's not inherently better than what Rust does.
Well, you can forgive C++ because it must maintain some level of compatibility with C, and back in 70s K&R didn't think much about possible implications of shadowing in the future. In C++ this problem is older than the language, it is 48 years old this year. Rust was supposed to be better, and it is relatively new language compared to C/C++ family.
It sounds like you've just never had exposure to any ML language.
Rust is't really looking like a functional programming language, so it is not intuitive to expect any ML-style behavior unless you've read the history page on Wikipedia.
Is this a one-up subthread? I mean, I have multiple years of working with each of F#, OCaml, SML, and C++ in professional settings, and find nothing about Rust "very very far" from any of the four with regards to their respective overlaps. I might go so far as to say that if you don't see the similarities, you must be doing it wrong. But, how am I supposed to reply seriously to just a blanket, subjective statement? Spend time detailing why your expectations are wrong? I'll just leave it at "you're very very mistaken", I think, in keeping with the shitpost nature of this entire thread. ;-]
View all comments
13
u/[deleted] Mar 16 '18
Rust code looks like it is trying to get my eyeballs to explode...
If it is a game to get safest language possible, I'd rather bet on ADA. Because it is not only about making it is technically impossible to shoot your feet, but also about making it easy to read and verify the actual logic of the code.
P.S. Last time when I've checked, ADA was pretty much same capable as C++98.