C represented strings as null-terminated arrays of ASCII
characters. This meant that you couldn't include '\0' in your
strings, and if you forgot the null terminator, you were
screwed. I hope you like buffer overflows. And the fact that
strings can be changed in-place by any piece of code with a
pointer to it should make anybody a little nervous. Strings, in
order to behave the way we expect, should be immutable by
default. More recent languages generally agree on these things.
Java, Python, and C# (among many others) all represent strings
as immutable objects, with the length recorded explicitly -- no
null-termination shenanigans. You can share memory among
substrings, and pass string values around without having to
worry about them being modified from some other thread
somewhere. This sort of thing pleases a compiler greatly, and
makes programs less bug-prone. This also makes it possible to
store only a single copy of short strings, to improve memory
efficiency, cache locality, and so on. Plus, you get ridi