4 ms·
The real problem is programming languages picking the wrong abstraction for their string type. Strings should be exposed as collections of code points, not code
by hgs3 4y ago
The real problem is programming languages picking the wrong abstraction for their string type. Strings should be exposed as collections of code points, not code units. UTF-whatever is an implementation detail. Python is one of the few mainstream languages to get this right.
- chrisseaton 4y ago> Strings should be exposed as collections of code points, not code units. Wasn't that the exact idea of using UCS-2? At the time it gave you 1-1 code-points and code-units. That's changed over time, but they didn't realise that when it was designed.
- hgs3 4y ago> Wasn't that the exact idea of using UCS-2? At the time it gave you 1-1 code-points and code-units. No. I'm saying that encodings don't matter. They are an implementation detail. Many programming languages are forever stuck with specific encodings because they exposed this implementation detail.
- chrisseaton 4y agoThe encodings do matter - you're forced to use a Unicode encoding. If you want to use a Unicode-incompatible encoding then FU.
- otabdeveloper4 4y agoThere's no such thing as a "code point", sorry to say. (I want to say "I told you so", remembering the silly arguments used 30 years ago about stateful text encodings, but that ship has thankfully sailed, leaving behind forever UTF-16 and other cruft.)
- hgs3 4y ago> There's no such thing as a "code point", sorry to say. Sure there is [1]. [1] https://en.wikipedia.org/wiki/Code_point https://en.wikipedia.org/wiki/Code_point
- otabdeveloper4 4y agoWikipedia lied (by omission), sorry. A Unicode "code point" doesn't correspond to a symbol or character.