Assume you are designing and implementing a new language from scratch, though you may freely borrow ideas from existing languages/implementations.
Question: If a programmer declares a string variable (assume strongly typed), how would you choose to store this variable in memory?
There are many use cases, but do you have a particular model that is superior in certain areas? Is your string mutable? Is it mutable, but only to a certain length that isn't the end of memory? Can I dynamically set the length, or can it only be done at compile time? Is it easy to access the 'nth' element? Does the string require a contiguous sector of memory? Could it be broken up into smaller strings?
Certain things to consider that programmers might like to do with your string: Calculating the length. Adding to the string. Extracting parts of the string (substrings). Applying Regex. Converting to a different value (number, boolean, etc)
EDIT: Clarifying what I mean.
If a user declares the following:
var Name : string
How would you choose, as the language designer, how to store this in RAM? What are the advantages and disadvantages of your method, etc.