I’ve always pointed out concrete issues with the string design in Julia, it’s not a matter of disagreeing or not with me, it’s about objective facts. The number of bugs that I fixed in the string handling code in the past, and the bugs that have been around for years and are still being found (like not handling the last character of a string correctly if is wasn’t ASCII in a search), as well as the performance issues with strings in Julia, back in v0.3 before I learned about Julia, and now in master can be easily shown with benchmarking.
The lack of validated string types goes against the strong recommendations of the Unicode organization, W3C, IETF, and other bodies, because of many known security issues.
Have you actually looked at the documentation and source code for Swift string support?
They keep track (like I do in Strs.jl) of properties of strings, like whether it is just ASCII, etc.
Given that most all text in the world can be represented using just the 16-bit BMP of Unicode, the Swift code has fast paths that optimize that case (so no slow “nextind” like issues).
You can perform all sorts of indexing operations on utf8
, utf16
, unicodeScalar
and other views of strings, random access is possible, not just iteration. Swift uses a String.Index type (a similar idea was discussed for Julia at one point, I believe), and you can even compare indices from different string types to see if they represent the same position in the string.
This works very intuitively, and performs very well.
IOBuffer
s can’t handle alternate string types, everything is geared towards data being forced to use UTF-8 encoding, and using them to build strings is rather clumsy, and people tend to write rather inefficient code instead, doing things like str += "ing"
, which is efficient in both Swift and Python.