Swift string handling

Please stop with the FUD; we all know that you prefer a different string design, but your endless refrain that disagreeing with you equates with a second-class design is tiresome. Swift’s String type reportedly uses a single variable-width encoding internally (UTF-16 last I checked, hence relatively inefficient for mostly-ASCII data), hence has an analogue of Julia’s nextind to increment string indices, while its Character type is actually a grapheme cluster (hence variable-width and relatively slow) analogous to Julia’s graphemes iterator over substrings. It also exposes iterators over code points and code units, but as far as I can tell these don’t support random access (only forwards and backwards iteration). Swift’s strings are mutable with copy-on-write semantics, whereas Julia uses IOBuffer for string building. Tastes differ, but it is not obviously superior to Julia’s approach, nor does it have major functionality that Julia lacks.

7 Likes