<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 Jan 20, 2016, at 5:29 PM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 8:27, Matthew Johnson 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="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="">The compiler will absolutely, 100%, inescapably need to know which properties a given partial method initializes. Otherwise it can't properly perform its phase one check, and if this proposal breaks safe initialization, it's not going to be accepted.<br class=""><br class="">We could specify that the compiler takes a peek at the implementation and figures out which fields it initializes, or we could specify that the method declares the fields it will initialize. But however we choose to do it, doing it in *some* way is not negotiable.<br class=""></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Yes of course it needs to know about what properties are initialized. &nbsp;It does not need to know about which properties have been initialized prior to calling the partial initializer though if we don’t allow it to read pre-initialized properties.</div></div></div></div></blockquote><br class=""></div><div class="">I know there's a new thread now, but this is simply incorrect. Consider a struct with a single, non-optional AnyObject field:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">struct Ref {</div><div class="">&nbsp; var referent: AnyObject</div><div class="">&nbsp; init func resetTo(newReferent: AnyObject) {</div><div class="">&nbsp; &nbsp; referent = newReferent</div><div class="">&nbsp; }</div><div class="">&nbsp; init(referent: AnyObject) {</div><div class="">&nbsp; &nbsp; resetTo.init(referent)</div><div class="">&nbsp; }</div><div class="">}</div></blockquote><br class=""><div class="">If 'referent' has already been set, the assignment has to release the old object; if it hasn't, it <i class="">must not</i>&nbsp;touch that memory (which is presumably uninitialized).</div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I'm not sure if this practically affects the proposal in any way, other than making it a little harder to implement. But it's an important part of the model.</div></div></div></blockquote><div><br class=""></div><div>Thanks for catching this Jordan. &nbsp;I was discussing requirements imposed by the partial initializer itself but of course any cleanup necessary must also happen and I didn’t fully consider that.</div><div><br class=""></div>John asked that the proposal disallow redundant assignment to make implementation easier, which is included in the new draft. &nbsp;I asked him whether this should apply to initial values for `var` properties but never got an answer. &nbsp;I think the point you make indicates why he made the request which also indicates disallowing writing to a `var` with an initial value, which I currently allowed for in the proposal. &nbsp;</div><div><br class=""></div><div>I am open to modifying the proposal in whatever way the compiler team thinks is best. &nbsp;:) &nbsp;Feel free to respond with your thoughts in either thread.</div><div><br class=""></div><div>Matthew</div><div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Best,</div><div class="">Jordan</div><div class=""><br class=""></div><div class="">more comments coming on the other thread</div></div></div></blockquote></div><br class=""></body></html>