3 ms·
Agree with basically everything here, plus I would add that this method also has weird ergonomics. For example there is technically a midpoint between these two
by dvt 2y ago
Agree with basically everything here, plus I would add that this method also has weird ergonomics. For example there is technically a midpoint between these two: `0b10u64.mid(&-20)`--but you get a weird compiler error ("unsigned values cannot be negated") which will be confusing to debug when you're just trying to find a midpoint between two numbers.
What I don't quite understand is why the opposite (`-20.mid(&0b10u64)`) still errors out with the same exact "unsigned values cannot be negated" error. Why is the unsigned and not the -20 taking prececence here? Doing `-20i64.mid(&0b10u64)` I get the expected error: "expected `&i64`, found `&u64`."
- Ygg2 2y agoBecause you can't find midpoint between two different types. One is unsigned other is signed. How would that even work?