Doesn&#39;t really seem worth the trouble to me. It is fine as it is. Other languages like Java and Scala allow this short hand and Swift allows it in closures. Not that I am that fussed since the brackets are no big deal. <span></span><br><br>On Saturday, 16 April 2016, John McCall via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; On Apr 15, 2016, at 2:47 PM, Joe Groff &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;jgroff@apple.com&#39;)">jgroff@apple.com</a>&gt; wrote:<br>
&gt;&gt; On Apr 15, 2016, at 11:43 AM, John McCall &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;rjmccall@apple.com&#39;)">rjmccall@apple.com</a>&gt; wrote:<br>
&gt;&gt;&gt; On Apr 15, 2016, at 10:41 AM, Joe Groff &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;jgroff@apple.com&#39;)">jgroff@apple.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt; On Apr 15, 2016, at 8:29 AM, John McCall via swift-evolution &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;swift-evolution@swift.org&#39;)">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On Apr 14, 2016, at 10:50 PM, Chris Lattner &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;clattner@apple.com&#39;)">clattner@apple.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt; On Apr 14, 2016, at 10:40 PM, John McCall &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;rjmccall@apple.com&#39;)">rjmccall@apple.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; To me, the unparenthesized style suggests that the input and output are peers, which feels more natural for the sort of value-to-value transform/predicate where this most commonly occurs.  Parenthesizing the input feels fussier, which contributes to a sense that the argument is just one component to producing the result.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; The parentheses are grammatically unnecessary in most cases (by frequency of use in higher-use programming, not by feature count).<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; I agree with your point that many simple higher order programming examples (e.g. map, filter, etc) take a single argument. That said, I don’t agree that this means that we should syntactically privilege this special case.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; &quot;Special case&quot; is a loaded phrase.  Why is it a special case as a parameter if it isn&#39;t a special case as a result?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Because, as I tried to explain in my original post, parameters *are* a special case.  The result type of a function is just a type. The parameter list allows things that types do not: default arguments and variadics.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Default arguments are not allowed in the type grammar.  Nor are different internal vs. external labels.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; As a concrete example, surely you aren’t arguing that we should support:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;   let x : Int… -&gt; Int<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; are you?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; No, but that&#39;s because the ... is a reference to the rest of the tuple and doesn&#39;t read correctly outside of one.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; I guess the flip side is that call and declaration syntax both require parentheses (unless the only argument is a trailing closure), but again, we had strong justifications for that: declarations would always be ambiguous without parens, and calls would have serious problems (and the style-wars factor would be much larger, especially now with mandatory keyword arguments by default).<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Right, but regardless of *why* we always require parens on Decls and ApplyExprs, we really do (and that isn’t going to change). Being consistent between func decls and function types is quite important IMO.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; So we should require function argument labels in function types?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Uhm, yes, we already do.  In:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;   let x : (a : Int) -&gt; Float<br>
&gt;&gt;&gt;&gt;&gt;   let y : (Int) -&gt; Float<br>
&gt;&gt;&gt;&gt;&gt;   let z : Int -&gt; Float<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; x and y have different (but compatible) types. y and z have identical types (sugared differently).<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; When I said &quot;function type&quot;, I was referring to this production in the type grammar, not the type signature component of function declarations.  I&#39;m not sure how I could&#39;ve been clearer on that without actually using the names of grammatical productions.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; My point was that allowing a function type to be written as &quot;(Int) -&gt; Float&quot; is already inconsistent with function declarations, because that is not legal function declaration syntax; you would have to write &quot;(_ : Int) -&gt; Float&quot;.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; The current language composes naturally here, and your proposal feels like an odd extra rule.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I feel like the current language no longer represents our reality, though (or at least, our current ideal vision for reality). We&#39;ve pretty thoroughly broken the &quot;functions have one argument&quot; model.<br>
&gt;&gt;<br>
&gt;&gt; I don&#39;t see this syntax as an offshoot of the &quot;functions always have one argument&quot; model.  I agree that that model is dead.<br>
&gt;&gt;<br>
&gt;&gt; However, I don&#39;t think users require its death to be underlined and written in bold; it only ever surfaced to them in bugs anyway.  But many functions do, nonetheless, have only one argument; and because of another change to the model, where argument labels are becoming part of the function&#39;s name and not its type, that argument can be written as just a type.<br>
&gt;&gt;<br>
&gt;&gt; So to me, this question is whether we add a weird special-case rule that mandates the use of parentheses because they&#39;re required in a bunch of more complex but less common situations.<br>
&gt;&gt;<br>
&gt;&gt;&gt; Changing the type grammar to reflect this seems good to me. I would think of it as changing the function type grammar to:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;     function-type ::= &#39;(&#39; (type (&#39;,&#39; type)*)? &#39;)&#39; &#39;-&gt;&#39; type<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; which, since the argument list can containing 0, 1, or many individual arguments, makes the parens more grammatically necessary.<br>
&gt;&gt;<br>
&gt;&gt; This is tautological.<br>
&gt;<br>
&gt; I don&#39;t think it is just a tautology. Without encoding it in the grammar, there&#39;s an ambiguity between tuples and multiple arguments; () -&gt; T could mean either &quot;takes a single () argument&quot; or &quot;takes no arguments&quot;. We could &quot;obviously&quot; disambiguate in favor of the latter interpretation, but then you&#39;re introducing special cases in the other direction to keep the U -&gt; T syntax working.<br>
<br>
This is a fair point, and one which would come up with (Int,Int) -&gt; Float as well — maybe the user really does mean to pass a single value that&#39;s an (Int,Int) pair.  I&#39;m not sure this really works out to being a special case at the user level, though, since in either model the user trying to write a function that takes a single tuple-typed parameter simply has to introduce the extra parens: (()) -&gt; Float or ((Int, Int)) -&gt; Float.  (Assuming that the type system preserves that structure in any way, of course.)<br>
<br>
John.<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;swift-evolution@swift.org&#39;)">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote><br><br>-- <br>-- Howard.<br>