|
|
|
|
|
by Capricorn2481
779 days ago
|
|
A type error means a type error, and nothing more. Type errors do not mean "incorrectness." Here is an example of something you can't do in rust, but can do in other statically typed languages. ```rust struct Type1 {
id: u32
} struct Type2 {
id: u32
} fn main() { let obj1 = Type1 {
id: 1
};
let obj2: Type2 = obj1; // compile error, Type1 is not Type2
}``` This code works perfectly fine. These two structs have the same signature. The only thing that doesn't work is the names. There are dozens of things like this where your code works but the compiler is too strict. This is terrible for rapid iteration. It's good for other things like modeling your domain with types. |
|