-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: bytes, strings: add Truncate #56885
Comments
Why runes?
So this seems like too much complexity for the ASCII case, and not nearly enough for the full Unicode case... what problems does that leave for it to solve? |
That is a valid criticism, I'm mainly using it for ASCII text. |
This proposal has been added to the active column of the proposals project |
FWIW when I want this functionality, it's usually because I want to limit the overall size in memory of something without producing malformed UTF-8. It's true that I might produce a malformed grapheme cluster, but I'd still submit that it's better to do that than splitting at an arbitrary byte. I'm not even sure that it's possible to split on grapheme clusters without going outside the standard library I have a strong recollection of having this discussion before, but I can't for the life of me find the discussion (ISTR that @rsc was involved). |
Similar to the discussion in #53120, this API seems to promise something but really doesn't promise much of anything. It is easy enough to write in a third-party library. It doesn't seem like we should have it here. |
Based on the discussion above, this proposal seems like a likely decline. |
No change in consensus, so declined. |
I find myself implementing this function pretty often and I thought it would be decent addition to the standard library.
The text was updated successfully, but these errors were encountered: