• huf [he/him]
    ·
    1 month ago

    ew...

    pub fn predict_crime(suspect: Person) -> bool {
       return suspect.race() == Race::Black
    }
    
    • TheDoctor [they/them]
      ·
      1 month ago

      Good change but also why is race a getter method while Race::Black is a constant enum? Is race an impure function dependent on global state? Is it derived from some other internal immutable state?

      • huf [he/him]
        ·
        1 month ago

        i dont even know what language this is :D i just thought it'd be a nice bit to silently pass over the racism aspect and nitpick the code

        • ProletarianDictator [none/use name]
          ·
          1 month ago

          It's Rust.

          If you omit the semicolon on the last line, it will return that value, so suspect.race() == Race::Black will return true/false for the containing expression.