On Wednesday 01 December 2010 03:17:48 spir wrote: > Well, nearly everything is in the title... I would intuitively opt for the > second type if I had to define an immutable string type. > > Answers from various points of view (semantic, praticality, efficiency...) > would be great if ever they may differ.
string str = "hello"; str ~ = " world"; That's wouldn't be possible if string were fully immutable. And since the fact that the elements of a string are immutable, passing a string to a function is guaranteed not to mess with the original, even if they append to the one passed in. So, making it fully immutable wouldn't really buy you anything anyway. - Jonathan M Davis