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

The string_view issue has popped up even in relatively safe languages. Java's String class used to do something similar, where substring returned a String that referenced the original String object's internal array to avoid a copy. They gave up on it because too many people accidentally held a references to large strings and leaked memory that way.


As far as I know, this is rather popular. Haskell's ByteString and Text still types do the same. So does Rust, where most of the time you are very consciously borrowing the original string instead of making copies.




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

Search: