r/ProgrammingLanguages • u/funcieq • May 23 '26
Discussion How to implement String?
Currently, String in my language is just value and length because it's a temporary solution, And as the language has developed, I am now able to rewrite a lot just for it, so I want to make a decent String in my language. So my question is, which String concept annoys you the least?
47
Upvotes
View all comments
7
u/baehyunsol Sodigy May 24 '26
My language uses char-array instead of byte-array, so it's a utf-32. I chose this because
Even though many of you're not gonna agree, I don't think utf-32 have significant performance disadvantage. Memory is cheap, unless you're training an AI model. A million characters string consumes 1~3MB (depending on your nationality), which is very small for today's RAM. There are rare cases you want to deal with strings bigger than that. If you have to handle a billion characters string, it's likely that your CPU is bottleneck, not your RAM.