Is this equivalent to having &quot;flags&quot; for functions? Like `--rsa`, `--aes`?<br><div class="gmail_quote"><div dir="ltr">On Sun, 13 Dec 2015 at 13:56, Drew Crawford via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<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">The problems with enums as parameters were explained in the proposal.  I don&#39;t see how these responses address any of the concerns that were initially raised.</div><div style="word-wrap:break-word"><div><br></div><div><br><div><div><blockquote type="cite"><div>On Dec 13, 2015, at 2:25 PM, David Owens II via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div 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:normal;word-spacing:0px">Agreed. It&#39;s also likely that you&#39;ll be setting some internal flag with this information already. <br><br>Sent from my iPhone</div><div 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:normal;word-spacing:0px"><br>On Dec 13, 2015, at 8:55 AM, Harlan Haskins via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite" 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:normal;word-spacing:0px"><div>Also I think it’d be cleaner to just accept an enum in one initializer<div><br></div><div><font face="Menlo">enum KeyType {</font></div><div><font face="Menlo">    case RSA</font></div><div><font face="Menlo">    case Curve25519</font></div><div><font face="Menlo">    case AES</font></div><div><font face="Menlo">}</font></div><div><br></div><div>Then you get that semantic niceness of:</div><div><br></div><div><font face="Menlo">init(keyType: .RSA)</font></div><div><font face="Menlo">init(keyType: .Curve25519)</font></div><div><font face="Menlo">init(keyType: .AES)</font></div><div><font face="Menlo"><br></font></div><div>— Harlan</div><div><br><div><blockquote type="cite"><div>On Dec 13, 2015, at 11:41 AM, Sean Heber via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="font-family:Helvetica;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:normal;word-spacing:0px">In this particular example, perhaps Key should be an enum instead of a struct.</div><div style="font-family:Helvetica;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:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;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:normal;word-spacing:0px">l8r</div><div style="font-family:Helvetica;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:normal;word-spacing:0px">Sean<br><br>Sent from my iPad</div><div style="font-family:Helvetica;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:normal;word-spacing:0px"><br>On Dec 13, 2015, at 10:07 AM, ilya via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite" style="font-family:Helvetica;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:normal;word-spacing:0px"><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>    init(forRSA:Void) { /* */ }</div><div>    init(forCurve25519:Void) { /* */ }</div><div>    init(forAES:Void) { /* */ }</div><div>}</div><div><br></div><div>let a = Key(forRSA: ())</div><div><div><br></div><div>or </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.  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> </span><span dir="ltr">&lt;<a href="mailto:drew@sealedabstract.com" target="_blank">drew@sealedabstract.com</a>&gt;</span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><span><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&#39;re just shuffling the deck.  We&#39;ve gone from a bad public API to a bad private API.</div><div><br></div><div>Actually, it&#39;s worse, because we now have BOTH a bad private API AND a bad public API.  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.  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="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div></blockquote><blockquote type="cite" style="font-family:Helvetica;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:normal;word-spacing:0px"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=z0Ft8gvIaLt1zLwfkl4og6osLD9N8tlWJY1PY2zqWLW99Np4Jcz0Yy7yFXKpxyEdN6jk-2BgTyflD52zbAyyE0K4AP72RKJuMaDWrirSSaT7PCL-2FyETxflm4Hz-2FHbkDVjSx5hKxtNzKTqFr6xsipdoQA3-2FpaEBz-2BjbgUzBKBi7GdzZUAgP2uLnQnHQKlFfrNlOQoiCiz6hLXGeA8oFXVvW14S0zmLUYKIZ7j7oP-2FFCDJ4-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;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:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;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:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:Helvetica;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:normal;word-spacing:0px"><span style="font-family:Helvetica;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:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;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:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;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:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;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:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;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:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43pXkLx-2B36P-2BPNJufHeY0dgdFhoqBDNPRvXi-2BkMRAWJdQTRuOel9Jw9KQJIVZo3V5acm1ZRM9wYRRbgbunz07ml-2Fu28Ozl5Ba1JxOKi1a2-2FWDLqJnkPV-2FRf6pokWRqYl2J-2Bd-2BX1fVhNpGYDw5KOwlgdeMAzc4mj-2BgHCl6Spr-2FGdj86RlE4PlEaZjQjUEKlwM47w-3D-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div></blockquote><blockquote type="cite" 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:normal;word-spacing:0px"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=OtwgWwWn2mvmck2XIGZZg64wEmoo4f4ILYe4SqMqwHqxN3eZAIV7UM1i5yAFeZEhiXg4i-2FVNm3jybjOSwj5eLQ0LK53V-2BSQqAz2oKtcWbNNiuyxoB4-2BSjsJiYMKD7UxmGKeCkw1uYId1srsD50jMd45HhwNddN5TRhjb10tiOB-2B66-2B-2BWhSN6Ap-2BBZP3eryjTJ89JU692QTNzJPSB4zbhPyNvvOrCoY0IjCmm3MXuxK4-3D" alt="" width="1" height="1" border="0" 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:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><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:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br 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:normal;word-spacing:0px"><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:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br 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:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" 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:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br 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:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" 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:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=kKLYQ91ZFOe6ryzRU3CXyiq4yOweT6LjPwa6z8Qwa5f-2FlPDgS5LAndZUn-2B-2F-2Fgfq2UYs8UuBRV-2B05Jwpcl5vPCzaqh8HLBbhi49cXotbTqJHTxcEKw0-2F6ou36UbIHQ7CcEkbTyCo1goMalmxDkJDjFNyEA78cWEvj-2FZmNbVz87W9nBek-2FbCyTG6uh93GkN4Tb2ppAGKZuamCmiaZeUHTyZUUwOi9psiE44D7Pprnebao-3D" alt="" width="1" height="1" border="0" style="min-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>
_______________________________________________<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>