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
Show parent comment
9
u/vmcrash May 23 '26
I completely agree. It makes a lot of sense to differentiate between immutable strings and string builders. The first can be put easily as a key into a hash map, the latter shouldn't. The first easily can be moved around, with the latter you must be very careful, not that some code unexpectedly modifies it.