<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>See below</div><div><br>Am 21.01.2016 um 19:11 schrieb Michael Wells via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt;:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">I’m in 100% agreement here. In this case, the Swift API Design Guideline seems to be aligned more with Objective C&nbsp;and it doesn’t feel &nbsp;at all Swift-y.&nbsp;<br class=""><br class="">-mw<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 21, 2016, at 9:23 AM, David Owens II 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=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ok, this is something that's bugged me since Swift was released. It was&nbsp;<i class="">almost</i>&nbsp;fixed it back in the 1.x days (I think that was when it changed to be a bit more consistent between top-level funcs and members funcs).<div class=""><br class=""></div><div class="">The question is this, why do we still implicitly have unnamed first parameters for non-init functions, and in <b><u>some</u></b> cases, suggest putting the name of the first parameter in the name of the function?&nbsp;</div><div class=""><br class=""></div></div></div></blockquote></div></div></div></blockquote><div><br></div><div>As you said in&nbsp;<span style="background-color: rgba(255, 255, 255, 0);"><b style="text-decoration: underline;">some</b> cases. So in most cases you want to have an implicit unnamed first parameter.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">- Maximilian</span></div><br><blockquote type="cite"><div><div 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=""><font face="Menlo" class="">&nbsp; &nbsp; func say(message: String, times: Int) { ... } // or</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; func sayMessage(message: String, times: Int) { ... }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; say("hello world", times: 5) // or</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; sayMessage("hello world", times: 5)</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; // vs.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; say(message: "hello world", times: 5)</font></div><div class=""><br class=""></div><div class="">Let me be clear, I completely understand why the _ is supported, and I understand that it's not feasible to implicitly convert all the ObjC interfaces to move the parameter name into the first position (though they could be annotated to do this...).</div><div class=""><br class=""></div><div class="">However, why are we continuing that tradition with _new_ Swift APIs? There seems to be a perfectly good spot for the first parameter name of a function: the first parameter slot.</div><div class=""><br class=""></div><div class="">The seemingly poor choice of this shows up in other places too, like Doug Gregor's <i class="">Naming Functions with Arguments Labels</i>&nbsp;proposal. The default for that is to always have the _ in the first name slot.</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp; say(_:times:)</font></div></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; sayMessage(_:times:)</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; // vs.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; say(message:times:)</font></div><div class=""><br class=""></div><div class="">The other unfortunate thing about this, is that this is another instance where "init" behaves differently then the rest of Swift. I think it would be great to unify this.</div><div class=""><br class=""></div><div class="">Am I just missing the really compelling rationale for this?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">David</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></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>