3 ms·
> 1) Why on earth does any higher-level language still use byte or codepoint counts for length? For the higher-level languages, I believe both Haskell and Pyth
by deathanatos 12y ago
> 1) Why on earth does any higher-level language still use byte or codepoint counts for length?
For the higher-level languages, I believe both Haskell and Python¹ now return code point lengths when their length function is called on a string.
> And why don't lower-level languages at least have a way to count / index by graphimes?
Even getting a code point count is difficult in most of those, sadly.
> If you need random access to a string
I really think that random access is not something you greatly need for working with strings, and that most operations are going to scan (linearly) into the string. (For example, splitting on a character requires first finding that character, which is a linear scan that can return an iterator to that position: random indexing is not required.) Sadly, most languages I've worked with, with the exception of C++, do not make great use of the concept of iterators.
¹A recent version of Python 3 is required.