Hacker News new | ask | show | jobs
by zwnow 301 days ago
I actually want string length. Just give me the length of a word. My human brain wants a human way to think about problems. While programming I never think about bytes.
3 comments

The whole point is that string length doesn’t necessarily give you the “length” of a “word”, and both of those terms are not well enough defined.
The point is that those terms are ambiguous ... and if you mean the length in grapheme clusters, it can be quite expensive to calculate it, and isn't the right number if you're dealing with strings as objects that are chunks of memory.
Humans speak many different languages. Not all of them are English, and not all of them have writing systems which make it meaningful to talk about "string length" without disambiguating further.
Why exactly would I care about humans not speaking any of the languages I speak?
My point is that "the human way" is not specific to the way you think about these things.