Simple immutable example doesn't work - why???

Louis Berube louis.p.berube at gmail.com
Tue Nov 12 17:40:25 PST 2013


Thanks to both TFF and Kenji for their excellent explanations. I 
think my head is going to explode ;).

So, as I understand it, there are two sorts of immutable entities 
in D.

The first is probably the one most familiar to the majority of 
us, which is an entity with immutable contents but with mutable 
binding. This is what TFF illustrated so well in his post above 
and what we are all familiar with as "string".

The second will take me longer to get used to, which is an entity 
with immutable contents *and* with immutable binding. This is 
what I tripped over in my example and what Kenji adroitly showed 
how to deal with in his post.

Does this correctly sum up what I have read? If so, this 
conversation has cleared up a great deal of my misunderstanding 
of how "immutable" works. It would be great to see the above 
examples in a D reference or tutorial (maybe the second edition 
of Andrei's book?).

Many thanks.


More information about the Digitalmars-d-learn mailing list