News for hackers. Stuff that matters.
Re:The Absolute Minimum Every Software Developer Must Know A... by hot_gril on Monday October 02, 2023 @11:39AM (#37739546)
Swift made an effort to handle grapheme clusters but severely over-complicated strings as a result. Look at all the SO answers to what should be simple questions, like finding a substring: https://news.ycombinator.com/item?id=32325511

I was working on an app in Swift that needed full emoji support once. We ended up writing our own string lib that stores things as an array of single-character strings.

Re:The Absolute Minimum Every Software Developer Must Know A... by marcellus23 on Monday October 02, 2023 @12:15PM (#37740189)
> many of which changed several times between Swift versions

This was true while Swift was developing but it's been stable now for several years. At some point that complaint is no longer valid.

Re:The Absolute Minimum Every Software Developer Must Know A... by hot_gril on Monday October 02, 2023 @12:21PM (#37740306)
You still see all the answers from old versions sitting around, often at the top. So yes it's still annoying. Part of it is because of how often they changed such fundamental things. The only other time I can think of a language changing strings like this was Python2->3.
Re:The Absolute Minimum Every Software Developer Must Know A... by marcellus23 on Monday October 02, 2023 @05:15PM (#37744491)
The last time the string API changed was in 2017. That was 6 years ago.
Re:The Absolute Minimum Every Software Developer Must Know A... by hot_gril on Monday October 02, 2023 @03:15PM (#37743010)
Also, realized "needed full emoji support" sounds silly. It needed to do a lot of string manipulation, with extended grapheme clusters in mind, mainly for the purpose of emojis.