What does the term immutable mean? Could you please explain me with
examples.
Jon Paal [MSMD] - 26 Jun 2007 20:00 GMT
cannot be changed
http://www.google.com/search?q=define+immutable
> What does the term immutable mean? Could you please explain me with
> examples.
Alex Meleta - 26 Jun 2007 20:03 GMT
Hi,
... immutable object is an object whose state cannot be modified after it
is created. This is in contrast to a mutable object, which can be modified
after it is created....
The source (and examples): http://en.wikipedia.org/wiki/Immutable_object
Alex
http://devkids.blogspot.com
> What does the term immutable mean? Could you please explain me with
> examples.
Richard Clafton - 26 Jun 2007 21:02 GMT
Hello bbawa1@yahoo.com,
> What does the term immutable mean? Could you please explain me with
> examples.
Google is your friend when looking for definitions....
Enter into google:
define:immutable object
tomk148@gmail.com - 26 Jun 2007 22:37 GMT
"LOLRTFM"
immutable objects are significant because of how the compiler will
deal with them. for instance C# strings are immutable, so if you say
string s = "bl";
foreach (int i=0; i<10; i++)
s += "a";
s+= "h";
the end result is what you think it would be, but the compiler will be
creating lots more temporary strings in between.
"bla", "blaa", "blaaa" ... etc
if strings weren't immutable you wouldn't have as many temporary
objects, but things maintenance behind the scenes would be slower.
When objects are immutable the compiler has more assumptions to work
on and will be faster in the long run (assuming you avoid stuff like
the above). So if something is immutable you should be aware of
temporary object creation getting out of hand.