> This inline type field is key for fast and effective type checks for all casts, similar to other type-safe languages (e.g., Java or Rust).
I am not a Java expert but I know enough Rust to detect a problem here. Maybe it just needs clarification?
Rust is often not in fact storing the "inline type field", so presumably they're thinking of some very particular cast and not "all casts". But what cast?
some_f64 as i32 // Nope, that's going to emit code to work out the closest integer
<&str>::try_from(filename).unwrap() // Nope, that's just going to check the filename is UTF-8 encoded
OK, they talk about "down casts" Rust doesn't have inheritance, but presumably they're thinking of e.g how you go from an IpAddr to an Ipv4Addr ? And now at last it makes a little sense, yes we do need to store the difference between v4 and v6 in the data structure. But, what I do not understand is, how can the equivalent C++ (without type++) do anything reasonable here? Why would this be a bug people repeatedly trip? I know C++ is famously the language for footguns, but this is some gets() level stuff if the "no type info YOLO cast" is a thing people actually write.