3 ms·
Arguably strings these days don’t really have scalar elements, not at least in the way we think. One “character” might be several distinct code points, and char
by reikonomusha 6y ago
Arguably strings these days don’t really have scalar elements, not at least in the way we think. One “character” might be several distinct code points, and character access might not be a linear time operation.
- alpaca128 6y agoIt still makes sense to expose those codepoint sequences as individual symbols for the sake of the programmer's sanity. In most cases we don't really need to care if it's a single latin letter or a combination of bytes that make up a weird emoji, we just want a simple way to iterate over what a human reader would call a single character.
- chrisseaton 6y ago> we just want a simple way to iterate over what a human reader would call a single character But that's almost never what a language is giving you with their 'characters'.