News for hackers. Stuff that matters.
Re:Swift System Is Now Open Source by cmckn on Friday September 25, 2020 @09:00PM (#24595557)
To make sure I have this right:

Graphemes are comprised of code points, code points are comprised of code units, and code units are a chunk of binary of variable length depending on the UTF flavor.

UTF-8 uses smaller code units so that strings containing only ASCII (for ex.) are of optimal size (in terms of memory). UTF-32 would mean each "character" takes up 32 bits regardless.

I think the String javadoc could be clearer here. The class overview mentions these concepts but the methods are not as forthcoming.

Thanks!

Re:Swift System Is Now Open Source by didibus on Friday September 25, 2020 @09:31PM (#24595694)
You got it. I find this SO does a good concise explanation for them: https://stackoverflow.com/a/27331885/172272