<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=""><div class=""><blockquote style="-webkit-print-color-adjust: exact; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); padding: 0px 15px; color: rgb(119, 119, 119); font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; margin-top: 0px !important;" class=""><p style="-webkit-print-color-adjust: exact; margin: 0px 0px 15px;" class="">Proposal link:</p><p style="-webkit-print-color-adjust: exact; margin: 15px 0px 0px;" class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0153-compensate-for-the-inconsistency-of-nscopyings-behaviour.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0153-compensate-for-the-inconsistency-of-nscopyings-behaviour.md</a></p></blockquote><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class="">Reply text:</p><blockquote style="-webkit-print-color-adjust: exact; margin: 15px 0px; border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); padding: 0px 15px; color: rgb(119, 119, 119); font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class=""><div style="-webkit-print-color-adjust: exact; margin: 0px;" class="">However, occasionally a constructor might be non-copying on purpose, so we'll need a way to disable the warning.</div></blockquote><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class="">How about the determination method mentioned in the proposal:</p><blockquote style="-webkit-print-color-adjust: exact; margin: 15px 0px; border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); padding: 0px 15px; color: rgb(119, 119, 119); font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class=""><div style="-webkit-print-color-adjust: exact; margin: 0px;" class="">... if developers are performing an assignment operation from within an initializer between <strong style="-webkit-print-color-adjust: exact;" class="">a property declared as <code style="-webkit-print-color-adjust: exact; margin: 0px 2px; padding: 0px 5px; white-space: nowrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px;" class="">@NSCopying</code></strong>and <strong style="-webkit-print-color-adjust: exact;" class="">an instance of a <nscopying style="-webkit-print-color-adjust: exact;" class="">protocol conforming class</nscopying></strong>.</div></blockquote><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class="">That is, there are two key factors determining whether a <em style="-webkit-print-color-adjust: exact;" class="">fixable</em> error or warning should be emitted:</p><ul style="-webkit-print-color-adjust: exact; margin: 15px 0px; padding-left: 30px; font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class=""><li style="-webkit-print-color-adjust: exact; margin: 0px;" class="">If the <em style="-webkit-print-color-adjust: exact; margin-top: 0px;" class="">destination</em> property has been declared as <code style="-webkit-print-color-adjust: exact; margin: 0px 2px; padding: 0px 5px; white-space: nowrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px;" class="">@NSCopying</code> in class definition</li><li style="-webkit-print-color-adjust: exact; margin: 0px;" class="">If the <em style="-webkit-print-color-adjust: exact; margin-top: 0px;" class="">source</em> value conforms to <code style="-webkit-print-color-adjust: exact; margin: 0px 2px; padding: 0px 5px; white-space: nowrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px;" class=""><NSCopying></code> protocol</li></ul><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2;" class="">Once both are true, then what compiler can be sure about is that developer definitely missed the required manual copy invocation and it would emit either an error or a warning correspondingly. Otherwise, compiler would not complain of anything and would just leave the decision up to developers.</p></div><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Feb 2017, at 18:16, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">On Feb 17, 2017, at 3:18 PM, Douglas Gregor <<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>> wrote:<br class=""><br class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0153-compensate-for-the-inconsistency-of-nscopyings-behaviour.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0153-compensate-for-the-inconsistency-of-nscopyings-behaviour.md</a><br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• What is your evaluation of the proposal?<br class=""></blockquote><br class="">I think a warning is very appropriate.<br class=""><br class="">However, occasionally a constructor might be non-copying on purpose, so we'll need a way to disable the warning. A few possibilities:<br class=""><br class="">* Use .self on the value<br class="">* Parenthesize the value<br class="">* Parenthesize the variable<br class=""><br class="">I don't favor using compiler magic. Too spooky.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></blockquote><br class="">Yeah, that's a pretty easy mistake to make.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• Does this proposal fit well with the feel and direction of Swift?<br class=""></blockquote><br class="">Yes. Swift usually tries to help you avoid mistakes.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""></blockquote><br class="">N/A.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></blockquote><br class="">Quick reading.<br class=""><br class="">-- <br class="">Brent Royal-Gordon<br class="">Architechies<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>