1. A method for implementing a string object defined in a programming language, comprising: receiving characters to be embedded in the string object; allocating a space for the string object, wherein the space includes a header which is appended to a character array of the string object; copying the characters into the character array of the string object; and initializing the header by initializing a class pointer in the header to point to a class for the string object, and by initializing a length field in the header to specify a length for the string object; whereby the string object remains compatible with previous implementations of the string object that use a character array that is separate from the string object.