4 ms·
If all possible notions of length are footguns, maybe there should be no default "length" operation available.
by lmm 1y ago
If all possible notions of length are footguns, maybe there should be no default "length" operation available.
- WorldMaker 1y agoIndeed. 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?