apple / swift-foundation

The Foundation project
Apache License 2.0
2.33k stars 145 forks source link

Un-deprecate contiguous ASCII #74

Closed parkera closed 4 weeks ago

parkera commented 1 year ago

The swift stdlib deprecated _isContiguousASCII, but Foundation depends on it for String extensions.

Is there a better entry point to use, or should we remove the deprecation from stdlib?

/swift-foundation/Sources/FoundationEssentials/String/String+Essentials.swift:109:70: warning: '_isContiguousASCII' is deprecated
            if encoding == .utf8 || (encoding == .ascii && str._guts._isContiguousASCII) {
glessard commented 1 year ago

The stdlib should at least have a failable String initializer that can validate ASCII. I think that could replace the current uses we make of the _isContiguousASCII property.

jmschonfeld commented 4 weeks ago

This was undeprecated with https://github.com/swiftlang/swift/pull/70726 so I think we can go ahead and resolve this