Announcement

Collapse
No announcement yet.

Rust cringe

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Pretty dystopian name. I foresee news articles like "The Kernel is Rapidly Rusting" or "Corrosive Code Retires Rust"... Why name it Rust?

    Comment


    • #12
      Originally posted by deusexmachina View Post
      Pretty dystopian name. I foresee news articles like "The Kernel is Rapidly Rusting" or "Corrosive Code Retires Rust"... Why name it Rust?
      Graydon Hoare doesn't remember for certain but his "Yeah, let's go with that" answer is that it's named after the family of fungi.

      Comment


      • #13
        Originally posted by rmoog View Post
        Here'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
        }
        }​
        Where's the type safety? We declared
        Code:
        let mut values = vec![1, 2, 3, 4];
        without any type. So you're going to unironically tell me that you want code in the kernel that at compile time decides it feels like it's an int_8t and nobody's taking into account that it may need to be a uint16_t? Are you going to solve that by making all variables int64_t? If you do that, it's bloat. If you don't, it's brown town with overflows. If this is decided not at compile time but at run time, like C++'s auto, then you gotta ask yourself didn't you just sell C++ to Linus, which he really wanted to keep out?
        Integer literals in Rust are i32 unless overridden.

        Code:
        // int32_t
        let foo = 0;
        
        // uint64_t
        let bar = 0_u64;
        Originally posted by rmoog View Post
        What 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?
        In Rust, an expression without a semicolon is a return statement.

        Originally posted by rmoog View Post
        Why "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.
        Macros end with an exclamation to tell you that they will be replaced by a preprocessor.

        Originally posted by rmoog View Post
        Why the hell statements like "if" and "while" do not have their conditions in a bracket? It's like C and Python had a miscarriage.
        Parenthesis are not needed given that the expression after the condition must be in curly braces.

        Originally posted by rmoog View Post
        Why the switch case uses "less than or equal to" op? Is this a language for engineers or for kids speaking leet?
        *sigh*

        Originally posted by rmoog View Post
        My 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.
        Then don't use it. Believe me, someone with your rancid attitude won't be missed at all.

        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.

        Comment


        • #14
          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;)
          Oh wow. I had forgotten that I already replied to this thread.

          Comment


          • #15
            I've just recently gotten Rust 1.66.1 in the updates. 45GB of RAMdisk is not enough to compile this piece of shit. Even LLMs take less memory.
            Last edited by rmoog; 27 May 2023, 06:54 AM.

            Comment


            • #16
              Originally posted by rmoog View Post
              I've just recently gotten Rust 1.66.1 in the updates. 45GB of RAMdisk is not enough to compile this piece of shit. Even LLMs take less memory.
              Remember me telling you that you won't be missed at all?

              Comment


              • #17
                Originally posted by wswartzendruber View Post
                Remember me telling you that you won't be missed at all?
                Ah yes, toxicity. Rust community at its finest.

                Comment


                • #18
                  Originally posted by rmoog View Post

                  Ah yes, toxicity. Rust community at its finest.
                  Nahh, that's just standard "Wednesday on Phoronix" behaviour. You don't need Rust for that.

                  Comment


                  • #19
                    Originally posted by rmoog View Post

                    Ah yes, toxicity. Rust community at its finest.
                    I can only judge you by the things you say. And from what I can tell, the sum total of your use of Rust is only so you can cry, whine, and complain.

                    *shrugs*

                    Comment


                    • #20
                      Originally posted by ssokolow View Post

                      Nahh, that's just standard "Wednesday on Phoronix" behaviour. You don't need Rust for that.
                      Why speak up for him? It's obvious that he hates Rust and has no intention of reconsidering with an open mind.

                      Comment

                      Working...
                      X