[swift-evolution] Pitch: Renaming CharacterSet to UnicodeScalarSet

Erica Sadun erica at ericasadun.com
Wed Sep 28 16:27:45 CDT 2016


Chris: "Also, it is worth saying that any source breaking change still has to have an 
ultra-compelling reason to be worth considering.  Despite having a framework to 
support some source breaking changes, we still want to minimize them where 
ever possible."

Since it seems to be open season on introducing a few, highly focused
breaking changes, let me throw this one out there.

Pitch: Renaming CharacterSet to UnicodeScalarSet

In Swift, String is defined as "a Unicode string value." and a "CharacterSet" 
represents a set of Unicode-compliant characters.

A CharacterSet's initializers are:
init()
init<S>(S)
init(arrayLiteral: UnicodeScalar...)
init(bitmapRepresentation: Data)
init(charactersIn: ClosedRange<UnicodeScalar>)
init(charactersIn: String)
init(charactersIn: Range<UnicodeScalar>)
init?(contentsOfFile: String)

Why not rename `CharacterSet` to `UnicodeScalarSe`t, and update the initializers
to reflect they're being initialized from the unicode scalars in strings and ranges?
I think the few places where the word `character` is left mentioned (in convenience
properties) can be better named from `punctuationCharacters` to `punctuation`, 
`controlCharacters` to `controlAndFormat`, etc.

-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160928/ce9af2d0/attachment.html>


More information about the swift-evolution mailing list