3 ms·
> Weak typing and type coercion is a major footgun in a language. Type coercion is an expression of strong typing, and it's inevitable if you want a language t
by msla 4y ago
> Weak typing and type coercion is a major footgun in a language.
Type coercion is an expression of strong typing, and it's inevitable if you want a language that's usable.
For example, "array of int of length 5" is a type, and "array of int of length 6" is a different type. Do you want to write a separate sort function for each of those types?
- tialaramex 4y agoI don't want to write a separate sort function, the computer can and should do all that work for me automatically. Because Default is tricky to genericise, there literally are 32 distinct implementations provided for Rust's [T; 1] through [T; 32] of Default::default() https://doc.rust-lang.org/src/core/array/mod.rs.html#467 https://doc.rust-lang.org/src/core/array/mod.rs.html#467