[swift-evolution] [swift-evolution-announce] [Review] SE-0027 Expose code unit initializers on String

Patrick Gili gili.patrick.r at gili-labs.com
Sat Feb 13 16:00:19 CST 2016

> On Feb 11, 2016, at 7:41 PM, Douglas Gregor <dgregor at apple.com> wrote:
> Hello Swift community,
> The review of SE-0027 "Expose code unit initializers on String" begins now and runs through February 16, 2016. The proposal is available here:
> https://github.com/apple/swift-evolution/blob/master/proposals/0027-string-from-code-units.md <https://github.com/apple/swift-evolution/blob/master/proposals/0027-string-from-code-units.md>
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:
> Proposal link:
> https://github.com/apple/swift-evolution/blob/master/proposals/0027-string-from-code-units.md <https://github.com/apple/swift-evolution/blob/master/proposals/0027-string-from-code-units.md>
> Reply text
> Other replies
>  <https://github.com/apple/swift-evolution#what-goes-into-a-review-1>What goes into a review?
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
> What is your evaluation of the proposal?
In general, I support the proposal. However, I have a problem treating String as a bucket of bytes. The introduction starts out by making the claim, "Going back and forth from Strings to their byte representations is an important part of solving many problems, including object serialization, binary and text file formats, wire/network interfaces, and cryptography." Essentially, these problems deal with an array of raw bytes, and I have to wonder why an application would push them into a String? This is the old problem we had in C with treating char[] as a an array of raw bytes, which we introduced numerous problems over time, especially when new character encodings came into the picture. We learned the hard way that we had to declare byte arrays as uint8[].

> Is the problem being addressed significant enough to warrant a change to Swift?
If an application developer very much wants to leverage the methods made available by String, I suppose this addresses a problem. However, I prefer the idea of adding the necessary view(s) to String, as was mentioned in the alternatives section of the proposal. Would String.UTF8View provide the same capabilities as String.UInt8View?

> Does this proposal fit well with the feel and direction of Swift?
I don't feel like it does. I like the alternative of new views better. String already has the CharacterView, and SE-0010 (https://github.com/apple/swift-evolution/blob/master/proposals/0010-add-staticstring-unicodescalarview.md <https://github.com/apple/swift-evolution/blob/master/proposals/0010-add-staticstring-unicodescalarview.md>) introduced the UnicodeScalarView (although, I don't know if this has been approved). If Swift is going to promote this notion of "views", then I like this alternative even more.

> If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
Safely? I can't think of an example.

> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Went back and reread through the thread that drove this proposal. Thoroughly read the proposal. Gave the implementation a quick look.

> More information about the Swift evolution process is available at
> https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>
> Thank you,
> Doug Gregor
> 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/20160213/b9951018/attachment.html>

More information about the swift-evolution mailing list