logoalt Hacker News

bruce343434today at 8:22 AM0 repliesview on HN

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