News for hackers. Stuff that matters.
Re:Comparing Parallel Rust and C++ by jandrese on Friday November 08, 2019 @12:40PM (#21484663)
I'm not sure I'd want it removed, but generics tend to be pretty horrific looking to people new to the language.

An example:

  fn largest<T>(list: &[T]) -> T {
    let mut largest = list[0];

    for &item in list.iter() {
        if item > largest {
            largest = item;
        }
    }
I'm sure experienced Rust devs look at that and say it's fine, but that's definitely a hurdle for new developers.
Re:Comparing Parallel Rust and C++ by slavik81 on Friday November 08, 2019 @09:45PM (#21489220)
You need to specify the properties of T that you use. So, that first line should be:

  fn largest<T: PartialOrd + Copy>(list: &[T]) -> T {
https://tomtongue.com/docs/rust-wk-20.html#trait-bounds
Re:Comparing Parallel Rust and C++ by pcwalton on Friday November 08, 2019 @02:22PM (#21485745)
What would you want to see instead? That's pretty much the same syntax as generics in Java.