2 ms·
I'm not convinced invariants are crucial. Common, certainly, but not crucial, I think the opacity is more important. Take Rust's core::net::Ipv4Addr, that's ob
by tialaramex 3y ago
I'm not convinced invariants are crucial. Common, certainly, but not crucial, I think the opacity is more important.
Take Rust's core::net::Ipv4Addr, that's obviously just a 32-bit value inside - it has no invariants to be maintained, but it's opaque, even though I know it's a 32-bit value, I am actually not able to just directly treat it as the value or prod that value, I have to use certain procedures, which include predicates (to ask if this is, for example, the broadcast address, or a loopback address) and some useful bit operations,