Pretty dystopian name. I foresee news articles like "The Kernel is Rapidly Rusting" or "Corrosive Code Retires Rust"... Why name it Rust?
Announcement
Collapse
No announcement yet.
Rust cringe
Collapse
X
-
Originally posted by deusexmachina View PostPretty dystopian name. I foresee news articles like "The Kernel is Rapidly Rusting" or "Corrosive Code Retires Rust"... Why name it Rust?
Comment
-
Originally posted by rmoog View PostHere's a Rust example program
Code:fn main() { let mut values = vec![1, 2, 3, 4]; for value in &values { println!("value = {}", value); } if values.len() > 5 { println!("List is longer than five items"); } // Pattern matching match values.len() { 0 => println!("Empty"), 1 => println!("One value"), 2..=10 => println!("Between two and ten values"), 11 => println!("Eleven values"), _ => println!("Many values"), }; // while loop with predicate and pattern matching using let while let Some(value) = values.pop() { println!("value = {value}"); // using curly braces to format a local variable } }​
Code:let mut values = vec![1, 2, 3, 4];
Code:// int32_t let foo = 0; // uint64_t let bar = 0_u64;
Originally posted by rmoog View PostWhat the hell is "fn", "mut", "len", "println"? It's "function", "mutable", "length", "print line" in Hungarian notation, the very notation that got C and C++ a reputation for being hardly readable, so ggwp for incorporating it into the core of the language. Also the lack of return at the end of main. What the hell? Every main has to return, that's how we do computers on this planet. And what kind of Bash naming scheme is that? "fn main", like you thought to write "function main" but were too drunk to hit all the letters?
Originally posted by rmoog View PostWhy "vec!" before the array? Why "!"? What are you "not"ing? The array? Well the array is a pointer, if you wanna "not" a pointer you'll get another pointer which more often than not you cannot access.
Originally posted by rmoog View PostWhy the hell statements like "if" and "while" do not have their conditions in a bracket? It's like C and Python had a miscarriage.
Originally posted by rmoog View PostWhy the switch case uses "less than or equal to" op? Is this a language for engineers or for kids speaking leet?
Originally posted by rmoog View PostMy final takeaway is that Rust is a toy language clearly designed to confuse the hell out of people who wrote in C, C++, Perl, Java, Groovy and many other languages that borrow syntax from C. It may be just there to compete with Brainfuck, Pascal, Perl, Python and Bash in terms of who has the craziest syntax. But if you want to compare it to C in terms of memory conservancy and type safety it's right up there in the same league as JavaScript. Please do the world a favor and stop shilling this language, nobody's paying you to do so. If you are concerned about memory safety in C programs, you can git gud at C scrub and post some pull requests.
Look, Rust has legitimate criticisms:
1. Inconsistent naming.
2. Overly aggressive type inferencing.
3. Blanket traits spammed everywhere conflict with user-defined ones that are more useful.
In any event, I will continue to do all future native code development in Rust until something more...coherent comes out that also has Rust's guarantees.
Maybe Zig will be that language. Rust has some very compelling features, but I feel like it's been made by drug addicts.
- Likes 2
Comment
-
Originally posted by ssokolow View Post
A file's directory hierarchy does dictate what module it's in. pub use is like making a symlink.
As for needing pub mod to mount things into that hierarchy, they chose the design they did because automatically mounting things into the hierarchy introduces complications, confusion, and footguns for things:- File-level conditional compilation (You can't just have a runtime error if a given file depends on platform-specific APIs not present on your platform like you would in Python where things like import posixpath as path are used and lumping multiple platforms into a single file can easily make awkwardly big files.)
- Code generation (Cargo wants you to cleanly separate human-edited files from files generated by build.rs, so you need something you can hang a #[path=...] attribute off of to bridge into them. That something is mod/pub mod.)
- Internal modules (pub mod foo { ... } inside the file is not fundamentally different from pub mod foo;)
Comment
Comment