The new API is useful for initializing string by pattern.<br>But should not replace the old API.<br><br>The reason we need 'as' is there's no character literal, like 'a' , '\nnnn' in other languages.<br><br><br><div class="gmail_quote"><div dir="ltr">Haravikk via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>于2016年7月23日 周六19:59写道:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On 22 Jul 2016, at 21:23, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><div><div><span style="white-space:pre-wrap">        </span>* What is your evaluation of the proposal?<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>I think I'm generally in favour (see later).</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><span style="white-space:pre-wrap">        </span>* Is the problem being addressed significant enough to warrant a change to Swift?<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>It's pretty minor but disproportionately annoying, so worth addressing.</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div><span style="white-space:pre-wrap">        </span>* Does this proposal fit well with the feel and direction of Swift?<br></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>This I'm not sure on, partly because no alternatives are given. In particular I'm wondering whether this could be addressed instead by adding a string literal version of the initialiser, as this should I think giving the compiler an exact match to select instead?</div><div><br></div><div>It's tough to weigh in on which is better though, as I don't use this much at all; I do however have a couple of uses of the Character initialiser that I'd be very slightly inconvenienced by if they were removed, but hardly upset about. I just wanted to float that I believe this may be an alternative that hasn't been considered:</div><div><br></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>public init(repeating repeatedValue:StringLiteralType, count:Int) { … }</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>public mutating func append(_ other:StringLiteralType) { … }</font></div><div><font face="Monaco"><br></font></div>But both alternatives are sufficiently Swift-y, and I'm not too bothered either way so long as the ambiguity is addressed.</div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>