| ▲ | bruce343434 an hour ago | |
So really there are 2 orthogonal axes: - A: can I change the value - B: can something else change the value (can I depend on a predictable stable value) Because the axes are orthogonal, hierarchical based subtyping (inheritance) breaks, but type classes (interfaces), ad hoc polymorphism, would work. In C, const answers A In rust, due to pointer aliasing restrictions (either one mut pointer xor any amount of read only pointers), (lack of) mut answers both A and B | ||
| ▲ | PhilipRoman 7 minutes ago | parent [-] | |
In C, const can also answer B, but only in non-pointer contexts. | ||