Unicode rules
If a String contains only scalars which are assigned in the standard library's version of Unicode, all of the properties you mention are indeed forward-stable.
To check whether a String contains any unassigned scalars:
"some string".unicodeScalars.contains { $0.properties.age == nil }
If a String does contain unassigned scalars, its interpretation may change when processed by a version of Unicode in which that scalar is assigned to something. Note that since the Swift standard library is a system library on Apple platforms, it is possible for a user to have different Unicode versions across their various devices (e.g. an iPhone running iOS X with Unicode X, might cloud-sync data with an iPad running iPadOS Y with Unicode Y).
You can use the .age
property to enforce a maximum Unicode version, if it is important for you to exclude characters which are too new and may not be reliably interpreted across all OS versions that you support.
This is a very specialised requirement and most applications do not need this.
Bug fixes
There are two possibilities to consider - whether any reworking of the standard library code will ever introduce a bug, and whether any bugs which we discover will be fixed.
Obviously nobody wants to introduce bugs, but we can't entirely rule out the possibility of them ever being introduced, either. The standard library algorithms are tested using Unicode's published test suites and other tests to try ensure they are accurate, but those test suites are also not (and cannot be) exhaustive.
So if we discover a bug, would we consider fixing it even though the fix could change the properties of some existing strings? The standard library maintainers will give you the definitive word, but IMO yes, it should always be under consideration.
The alternative would be that we continued to ship an incorrect implementation in String
for stability purposes, but of course we would discourage using it, and would have to introduce some kind of fixed String2
which we would encourage developers to use instead. As more bugs may be discovered in the future, we might further have to introduce String3
, String4
, etc. That's clearly not good, so I think we would consider the best path forward to be modifying String
's behaviour in this hypothetical scenario, even if it means some properties change behaviour.