<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Previously:</div><div class=""><br class=""></div><div class="">&lt;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160509/016982.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160509/016982.html</a>&gt;</div><div class=""><br class=""></div><div class="">&lt;<a href="http://discourse.natecook.com/t/proposal-allow-function-argument-type-to-be-omitted-when-passing-a-default-value-from-which-it-can-be-inferred/1540" class="">http://discourse.natecook.com/t/proposal-allow-function-argument-type-to-be-omitted-when-passing-a-default-value-from-which-it-can-be-inferred/1540</a>&gt;</div></div><br class=""><div><blockquote type="cite" class=""><div class="">On 10 Mar 2017, at 21:40, Kilian Koeltzsch 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="">Hi all,<div class=""><br class=""></div><div class="">I sent the message below to swift-users@ ~a day ago, but this might be a better place to ask and gather some discussion. It is a rather minor suggestion and I'm just looking for some opinions.</div><div class=""><br class=""></div><div class="">Declaring a function that has default parameters currently looks like this:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;foo(bar:&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">String</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;=&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);">"baz"</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">print</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(bar)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div></div><div class=""><br class=""></div><div class="">Now I'm wondering if there would be any problems if it were possible to omit the type annotation for default params and let Swift's type inference handle that.&nbsp;</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="" style="color: rgb(186, 45, 162);">func</span>&nbsp;foo(bar =&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);">"baz"</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">print</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(bar)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div></div><div class=""><br class=""></div><div class="">It feels to be equivalent to omitting type annotations with variable declarations. Obviously more complex types would still require annotations being specified. Off the top of my head I can't think of any negative ramifications this might bring, be it in simple function/method declarations or protocol extensions and elsewhere.&nbsp;</div><div class="">Any further input or examples for situations where this might cause issues would be much appreciated :)</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Kilian</div></div></div></blockquote></div></body></html>