<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 19, 2017, at 16:16, Howard Lovatt via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The review of "Substring performance affordances" begins now and runs through July 21, 2017. The proposal is available here:<br class="">
<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0183-substring-affordances.md" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0183-substring-affordances.md</a><br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; • What is your evaluation of the proposal?</blockquote><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Generally good. The reservation I have is there are an increasing number of ‘small’ proposals that paper over the limitations of protocols. If protocols could be used as a type then the methods in `StringProtocol` would return `StringProtocol` and methods would accept `StringProtocol`. Whether `String` or `StringSlice` is actually returned by a method would be irrelevant. Is it better to spend the engineering effort on improving protocols and `Self` rather than continuously ‘papering over the cracks’.&nbsp;</div></div></div></div></blockquote></div><div><br class=""></div><div>Using protocols as types has various performance penalties (more virtual method calls, and, depending on the size of the data, allocations) and semantic downsides that would likely defeat the purpose of splitting String from Substring. It would be essentially the same as having a String can implicitly be a Substring (a slower version of something like `enum StringProtocol { case String_(String), Sub(Substring) }`) which was touched on in the string manifesto:&nbsp;<a href="https://github.com/apple/swift/blob/master/docs/StringManifesto.md#same-type-shared-storage" class="">https://github.com/apple/swift/blob/master/docs/StringManifesto.md#same-type-shared-storage</a></div><div><br class=""></div><div>Huon</div></body></html>