how would D be different if string were const(char)[]?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Oct 17 12:53:23 PDT 2013
On Thursday, October 17, 2013 21:17:37 Daniel Davidson wrote:
> Strings/slices have sharing. Can the same issue/benefit occur
> with primitives? Would you ever have a need for `immutable(int)`
> over `const(int)`?
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.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list