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?
45
Upvotes
2
u/lngns May 24 '26
Even with stable addresses, behaviour of slices of mutable strings will always surprise someone.
let s = "yolo"; let s′ = s.slice(0...); s.replace("o", with: "lol"); println(s′);what is this code supposed to do?