<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>In this particular example, perhaps Key should be an enum instead of a struct.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">l8r</div><div id="AppleMailSignature">Sean<br><br>Sent from my iPad</div><div><br>On Dec 13, 2015, at 10:07 AM, ilya via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Good point on that. I still think the best solution is to take the existing syntax of<div><br></div><div><div><br></div><div>struct Key {</div><div>&nbsp; &nbsp; init(forRSA:Void) { /* */ }</div><div>&nbsp; &nbsp; init(forCurve25519:Void) { /* */ }</div><div>&nbsp; &nbsp; init(forAES:Void) { /* */ }</div><div>}</div><div><br></div><div>let a = Key(forRSA: ())</div><div><div><br></div><div>or&nbsp;</div><div><br></div><div>let empty: Void = ()</div><div>let c = Key(forAES: empty)</div></div></div><div><br></div><div>and make it somewhat easier to read.&nbsp; Perhaps<br></div><div><br></div><div><div>let b = Key(forCurve25519: _ )</div><div><br></div><div>I think many people will read Key(forAES) as Key.init(_: forAES), so that may be not the best expression here.</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 13, 2015 at 4:21 PM, Drew Crawford <span dir="ltr">&lt;<a href="mailto:drew@sealedabstract.com" target="_blank">drew@sealedabstract.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Dec 13, 2015, at 7:13 AM, ilya &lt;<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank">ilya.nikokoshev@gmail.com</a>&gt; wrote:</div><br><div><span style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;float:none;display:inline!important">You can easily call a private parametrized init from a class function though. </span></div></blockquote></div><div><br></div></span><div>Sure, but we're just shuffling the deck.&nbsp; We've gone from a bad public API to a bad private API.</div><div><br></div><div>Actually, it's worse, because we now have BOTH a bad private API AND a bad public API.&nbsp; There is a reason that NSData.dataWithData(...) is a Swift compile error.</div><div><br></div><div>The (ab)use of class functions as constructors is a holdover from ObjC times.&nbsp; If you want to make an instance in Swift, you should type ClassName( and see what autocomplete suggests; you should not have to read through the documentation of class functions to see if they are secretly constructors that have been filed at the wrong shelf in the library.</div></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=CzM39owGTpkJ1zyGXnrRVEXja65D5KHvjV3-2BNib8-2FALraiVmeCRqDAcj1l8z35EyfyxNce005dhh8czCOSygpB8GvaO8YBxaQjp7cp-2BBsyWr73gn4wJKxfTOkE5nFIZJelApEPJM1H59akcJetq4urRVdzsTIzlv-2F88JrTaucp-2BaKFp8H5VvwwKgMILL2g5eYmSJgmhb-2BOsdcumzws0bbPbuhNZaMi2B5y4MhwYz-2BI8-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></body></html>