<div dir="ltr">+1 I agree. Unwrapping in the functional signature is confusing for the user; many don’t realize that it puts the burden of checking on them. Non-optional function parameters make this explicit by preventing passing in Optional types, forcing the user to check, which they should be doing anyway.<br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 8, 2016 at 12:22 PM J. Charles M. N. 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"><br>
This confused me at the beginning.<br>
<br>
But doesn&#39;t Int! In parameter type means the function is awaiting an unwrapped value so the user should ensure that it data parameter is available, valid, and unwrapped?<br>
<br>
--<br>
J. Charles<br>
<br>
&gt; Le 8 juin 2016 à 13:30, Spromicky via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; a écrit :<br>
&gt;<br>
&gt; Hello, everyone!<br>
&gt;<br>
&gt; I wanna propose to you to remove force unwrapping in fuction signature for swift code. That no sense in clear swift code. If we wanna use some optional value as function param, that is not optional, we must unwrap it before function call.<br>
&gt; People who new in swift look at how they old Obj-C code (without nullability modifiers) translate in to swift:<br>
&gt;<br>
&gt; Obj-C:<br>
&gt; - (void)foo:(NSInteger)bar {<br>
&gt;    //...<br>
&gt; }<br>
&gt;<br>
&gt; Swift transaliton:<br>
&gt; func foo(bar: Int!) {<br>
&gt;    //...<br>
&gt; }<br>
&gt;<br>
&gt; And think that force unwrapping in signature is good practice. And start write functions in clear swift code like this:<br>
&gt;<br>
&gt; func newFoo(bar: Int!) {<br>
&gt;    //...<br>
&gt; }<br>
&gt;<br>
&gt; and use it like this:<br>
&gt;<br>
&gt; let bar: Int? = 1<br>
&gt; newFoo(bar)<br>
&gt;<br>
&gt; And it really work, and they does not think that this can crash in case if `bar` will be `nil`.<br>
&gt; But in clear swift we wanna work with parametrs in function that clearly or optional, or not.<br>
&gt;<br>
&gt; func newFoo(bar: Int) {<br>
&gt;    //...<br>
&gt; }<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; func newFoo(bar: Int?) {<br>
&gt;    //...<br>
&gt; }<br>
&gt;<br>
&gt; When we write a new function we know what we need in this case and use optional params or not.<br>
&gt;<br>
&gt; So my proposal is remove force unwrapping(`!`) from function signatures, cause it have no sense, and that confuse new users.<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
_______________________________________________<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><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">-Saagar Jha</div></div>