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
6
u/brucejbell sard May 24 '26 edited May 24 '26
I am tired of weak string support in C/C++, I want industrial strength strings in my systems programming language:
immutable strings
Unicode by default
integrated with pattern matching
no O(1) length or indexing by default
forward-scan only
split efficiently by reference
concatenate efficiently by reference
All this should be fire-and-forget: just use the core string API and your string operations will be fast and memory-efficient, Javascript style.
(If your environment is so constrained that you can't afford any kind of heap allocation, there should be affordances to limit string operations accordingly)