|
|
|
|
|
by ndeine
4420 days ago
|
|
He means immutability when he says "const-ness". There are four possibilities for mutability of a single pointer: 1. The pointer is mutable, but its contents are immutable. 2. The pointer is immutable, but its contents are mutable. 3. The pointer is immutable and the contents are immutable. 4. The pointer is mutable and its contents are mutable. Right now for owned pointers Rust gives us (3) and (4), but no obvious way to achieve (1) and (2). Although you might argue that the borrowing semantics give us these powers, just not directly with owned pointers - which we shouldn't be using directly if we're asking for that control, we should be lending them out in a well-controlled manner. |
|