Steven Schveighoffer <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #3 from Steven Schveighoffer <> 2010-02-18 
11:23:09 PST ---
It does have immutable traits.  With D's immutable strings, the *shared* part
is immutable.  That is, you can share strings because of the hybrid
value/reference type that is an array (shared data, local length).  It's a very
different concept to other programming languages.

Because strings are not true reference types, changing the length of one string
does not affect another string, even if both point to the same data.

Think about how Java has immutable strings, but you can reassign a string
variable.  That does not make the strings themselves not immutable!  However,
immutable strings in Java are pure reference types (even the length is shared),
so in order to take a "slice" of a string, you must make an entirely new
object, but the same data (except for the length) is referenced.  The same is
not true in D where the string length is not shared, and therefore does not
need to be immutable.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to