[swift-evolution] Pitch: Renaming CharacterSet to UnicodeScalarSet

Dave Abrahams dabrahams at apple.com
Fri Sep 30 07:17:29 CDT 2016


on Wed Sep 28 2016, Erica Sadun <swift-evolution at swift.org> wrote:

> 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

Hi Erica,

This is out-of-scope for this list, because CharacterSet is part of
corelibs-foundation.  I suggest posting on
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev, where the
Foundation people hang.

> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>

-- 
-Dave



More information about the swift-evolution mailing list