Re:The Absolute Minimum Every Software Developer Must Know A...
by hot_gril on Monday October 02, 2023 @11:42AM
(#37739585)
There was no string.length in Swift for a while. Then they added one that just does what the user expects, get the number of grapheme clusters. If a user figures out that this isn't what they want, they can go use the other length method.
[ Parent
| on HN ]
Re:The Absolute Minimum Every Software Developer Must Know A...
by dathinab on Wednesday October 04, 2023 @09:09AM
(#37764540)
except if it's server swift code, then it doesn't do what the user expects at all
Re:The Absolute Minimum Every Software Developer Must Know A...
by hot_gril on Wednesday October 04, 2023 @02:32PM
(#37769576)
The most common reason I can think of a server wanting the string length is because it's enforcing a character limit in some field, in which case it does what the user expects. You aren't often manually managing memory in Swift. On top of that, Swift on server is probably rare to begin with.