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

For certain use-cases, but it's not like any of the other usual notions of text length are any better for what you want.




If all possible notions of length are footguns, maybe there should be no default "length" operation available.

Indeed. Several languages have debated dropping or already dropped an easy to access "Length" count on strings and making it much more explicit if you want "UTF-8 Encoded Length" or "Codepoint count" or "Grapheme count" or "Grapheme cluster count" or "Laid out font width".

Why endorse a bad winner when you can make more of the trade-offs more obvious and give programmers a better chance of asking for the right information instead of using the wrong information because it is the default and assuming it is correct?




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

Search: