| Also a law that the author is thinking of one and only one programming language. > String length is typically determined by counting codepoints. That depends entirely on what "strings" you are talking about. In C/Go/Rust/Ruby, char*/string/std::string::String/String is bytes. In Java/JavaScript, java.lang.String/String is UTF-16 code units. In Python 3, str is code points. In Swift, String is extended grapheme clusters. In Haskell, there are various different "string" types in common use. And in C++, std::basic_string is a generic container for whatever element type you want. (std::string specialization being for bytes.) EDIT: Clarified that I don't disagree with parent comment; merely pointing out additional less-than-precise language. |
The point is that those two sentences themselves in the article are conflicting with each other, not that we're talking about any language in particular. (But certainly the article could go into a survey of common languages like you have.)