<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 28, 2017, at 2:41 PM, David Hart <<a href="mailto:david@hartbit.com" class="">david@hartbit.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Should authors use StringProtocol or String as often as possible?</span></div></blockquote></div><br class=""><div class="">Our general advice is to stick with String. Most APIs would be simpler and clearer just using String rather than being made generic (which itself can come at a cost), and user conversion on the way in on the few occasions that's needed isn’t much of a burden.</div><div class=""><br class=""></div><div class="">The exception is when your API is extremely likely to be used with substrings. The most common case for this is that it’s an API for doing string processing (such as with join or the number initializers), or when it’s very likely used with substring and conversion to string would be a major potential bottleneck (such as with set/dictionary). Also, very general algorithms that would benefit from being on StringProtocol might also be generalizable further to Sequence/Collection.</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>