<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Dec 23, 2015, at 11:57 PM, Charles Srstka via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><blockquote type="cite" class="">On Dec 23, 2015, at 11:09 PM, Riley Testut <<a href="mailto:rileytestut@gmail.com" class="">rileytestut@gmail.com</a>> wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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; float: none; display: inline !important;" class="">Glad to see there's definitely some interest in this community then! I would love to start writing up a final proposal to submit to the Swift-Evolution repo, but I think that last piece of information needed would be the actual method of initialization, specifically should we allow for returning instances from convenience initializers, or should we simply assign to self?<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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; float: none; display: inline !important;" class="">Personally, I think returning from the initializer makes the most sense, especially because "self" in a protocol extension seems ambiguous. However, I'm not that much in favor that I couldn't be convinced to simply assign to self, because that already has some low level support in the language. Anyone have strong thoughts one way or another?</span></div></blockquote></div><br class=""><div class="">Assigning to self was always a bit weird. I think returning an instance makes more sense intuitively. It’s also, as you say, unclear exactly what “self” even means in the context of a protocol.</div><div class=""><br class=""></div><div class="">Probably the way I’d do it would be to have the method declared “factory init” and be required to return an object.</div></div></blockquote><div><br></div>+1 assuming we want to use the same syntax in type and protocol extensions. I don't like assign-to-self in a protocol extension. <div><br></div><div>Returning the instance also matches how factory methods are usually done in other languages. That shouldn't carry too much weight but it is worth noting.<div><br></div><div><br><blockquote type="cite"><div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAei8aOz7p8KsGD2K004mTVy0R8GCVW7n3bnfr1g7Fm1uhecV62COlVSyZRVfufzCYCQRndfBwBnee0Na9JM2KrNXhwD8YdUxs56177OtL0n7Jl6STFKOhCamCs2odjAHDn1EjsP81FDfiTmLSAeBNuTgODNc1TWcn7SVHNccEgAEm3VkMAqKD2tC6D8YvEv1Qc-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;">
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></body></html>