[swift-evolution] [swift-evolution-announce] [Accepted] SE-0163: String Revision: Collection Conformance, C Interop, Transcoding

John McCall rjmccall at apple.com
Wed Apr 19 12:27:09 CDT 2017


> On Apr 19, 2017, at 1:25 PM, John McCall <rjmccall at apple.com> wrote:
> 
> Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0163-string-revision-1.md <https://github.com/apple/swift-evolution/blob/master/proposals/0163-string-revision-1.md>
> 
> Hello Swift Community,
> 
> The review of SE-0163 "Improve Interaction Between `private` Declarations and Extensions” ran from April 5th through 11th, 2017. The proposal is accepted with revisions.

And now everyone knows that I copy-and-paste these from Doug.  This should read "The review of SE-0163 "String Revision: Collection Conformance, C Interop, Transcoding"", of course.

John.

> 
> Feedback from the community was positive.  There was a question during the discussion about how best to construct a String from an array of characters that may or may not be NUL-terminated.  Upon reflection, the proposal authors decided that it would best if String provided an initializer that took a collection of code units; feedback on that idea was also positive.  The proposal authors also decided that it would be best if strings could be easily converted to a C string with an arbitrary encoding; this was not discussed during the review, but the core team felt that this was obvious enough and sufficiently similar to other API that it did not demand an additional formal review period.  Accordingly, this proposal has been accepted with the following two revisions:
> 
> 1. String will also add the following initializer:
> 
>   /// Constructs a `String` having the same contents as `codeUnits`.
>   ///
>   /// - Parameter codeUnits: a collection of code units in
>   ///   the given `encoding`.
>   /// - Parameter encoding: describes the encoding in which the code units
>   ///   should be interpreted.
>   init<C: Collection, Encoding: UnicodeEncoding>(codeUnits: C, encoding: Encoding)
> 
> 2. String will also add the following method, analogous to the withCString method that has already been proposed:
> 
>   /// Invokes the given closure on the contents of the string, represented as a
>   /// pointer to a null-terminated sequence of code units in the given encoding.
>   func withCString<Result, Encoding: UnicodeEncoding>(encoding: Encoding,
>     _ body: (UnsafePointer<Encoding.CodeUnit>) throws -> Result) rethrows -> Result
> 
> John McCall
> Review Manager
> _______________________________________________
> swift-evolution-announce mailing list
> swift-evolution-announce at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution-announce

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170419/1691648a/attachment.html>


More information about the swift-evolution mailing list