On Thursday, 17 October 2013 at 19:53:34 UTC, Jonathan M Davis wrote:
For value types, there's no real difference between immutable and const. Because they're value types, you can't have mutable references to them. The differences between const and immutable only really come into play once you're dealing with reference types, because then you can end up with differently
qualified references to the same data.

It is important to make clarify that this is true only for directly accessible value types. Once any single level of indirection is in question, `const` stops giving any guarantees. This is exactly the case for `const(char)[]` vs `immutable(char)` - `const(char)` itself is a value type but pointer to `const(char)` can also store pointer to mutable `char`.

Reply via email to