3 ms·
TFA makes a very good case that Swift got it wrong. Perhaps string length should be more hidden though, or parametrized with a unit to count. Perhaps it shoul
by cryptonector 7y ago
TFA makes a very good case that Swift got it wrong.
Perhaps string length should be more hidden though, or parametrized with a unit to count. Perhaps it should be
let nu = s._smelly_length(UTF8CodeUnits);
let nc = s._smelly_length(ExtendedGraphemeClusters);
Stop using "zero length" to denote empty string, just have an empty string method.
- favorited 7y agoNot sure how you read "Swift’s approach to string length isn’t unambiguously the best one" and interpret it as "Swift got it wrong." The author's substantive criticism of Swift's String/Character/etc. types seems to be complications arising from the dependency on ICU (such as not necessarily being able to persist indices across icu4c versions).