Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You cannot take a substring without copying.

That's not a bug, it's a feature. Indeed, immutable strings should almost always be the default choice due to security concerns alone. C is optimized for the rare case, modern languages with immutable strings (like C#) are optimized for the common case, this is how it should be.



I think you missed the point. Even with immutable strings, some representations will allow you to take a substring without copying data and some will not. Length-prefixed strings do not.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: