<div>IMO, considering &quot;throws&quot; is a modifier of function/method and determines how the function can be called (another good example is mutating) the logical approach would be to make things consistent and move everything either to the beginning or to the end of declaration.</div><div><br></div><div>As long as &quot;throws&quot; is the only modifier at the end it&#39;s very logical to move it to the beginning and rename to &quot;throwing&quot;. It feels like &quot;throws&quot; at the end is rather a legacy, probably from other languages and was a _default_ way of thinking at the time of initial implementation.</div><div><br></div><div>I personally can live with both, though for the sake of consistency it should be moved to the beginning.</div><div><br><div class="gmail_quote"><div>On Tue, 27 Dec 2016 at 6:00 thislooksfun 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" class="gmail_msg">As far as I know, `throws` only affects whether or not the code must be marked with a `try` statement, the actual return type/value is unchanged (since it would be unreached if an error was thrown).<br class="gmail_msg"><div class="gmail_msg"><br><br><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="gmail_msg"><br class="gmail_msg">-thislooksfun (tlf)</div><br><br><br><br></div></div><div style="word-wrap:break-word" class="gmail_msg"><br><br><br><br><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Dec 26, 2016, at 1:18 PM, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="gmail_msg" target="_blank">davesweeris@mac.com</a>&gt; wrote:</div><br class="m_4996534704032090138Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">On Dec 26, 2016, at 09:38, thislooksfun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">Hello Swifters,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I&#39;ve been writing a lot more Swift code recently, and I have found that the default placement of the &#39;throws&#39; declaration is often confusing, especially to those of us switching from languages where the type of errors thrown is explicitly defined (like Java)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">For example,</div><div class="gmail_msg"><div class="m_4996534704032090138bloop_markdown gmail_msg" style="font-family:Helvetica,Arial;font-size:13px;background-color:rgb(254,254,254)"><pre style="margin-top:15px;margin-bottom:15px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal" class="gmail_msg">// This is pretty clear, this can throw an error<br><br>func foo() throws<br><br>{ ... }<br><br><br><br>// Also pretty clear, this returns a String<br><br>func bar() -&gt; String<br><br>{ ... }<br><br><br><br>// Confusing. Does this throw a String? Does it return a String? Does it do both?<br><br>// I personally keep reading this as &#39;this can throw a String&#39;<br><br>func baz() throws -&gt; String<br><br><br><br>// Equivalent code in Java (not a model, just for clarification of why the above is confusing)<br><br>String baz() throws StringFormatException</pre></div><div class="gmail_msg">I therefore suggest either tweaking the syntax around, or moving, the `throws` keyword to avoid this confusion.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Some ideas I&#39;ve had:</div><div class="gmail_msg"><pre style="color:inherit;margin-top:15px;margin-bottom:15px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal" class="gmail_msg">// Add a comma to separate them<br><br>func baz() throws, -&gt; String<br><br><br><br>// Move `throws` to the end<br><br>func baz() -&gt; String throws<br><br><br><br>// Change it to a prefix modifier (like `mutating`)<br><br>throwing func baz() -&gt; String<br><br></pre></div><div class="gmail_msg">I&#39;m still not sold on any of the above syntaxes, but I would love to hear your feedback.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">This would affect existing code, but it would be a fairly small change that would result in very large readability improvements, especially for newcomers, and <i class="gmail_msg">especially</i> for those coming for a language such as Java.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="gmail_msg">-thislooksfun (tlf)</div></div></div></div></blockquote><br class="gmail_msg"><div class="gmail_msg">Does `throws` affect the actual return type? That is, is the size of the returned data different between &quot;func foo() -&gt; Int8&quot; and &quot;func foo() throws -&gt; Int8&quot;? If so, the &quot;throws&quot; is quite literally part of the return type and the current syntax reflects that. If not, I <i class="gmail_msg">think</i> I&#39;d probably be in favor of that last &quot;prefix modifier&quot; suggestion with either &quot;throwing&quot; or &quot;@throwing&quot; (depending on the exact semantics of the &quot;@&quot; part — I&#39;m a bit unclear on that detail)... probably... maybe... I&#39;ll have to think about it some more.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">- Dave Sweeris</div><div class="gmail_msg"><br class="gmail_msg"></div></div></div></blockquote></div><br class="gmail_msg"></div>_______________________________________________<br class="gmail_msg"><br>swift-evolution mailing list<br class="gmail_msg"><br><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"><br></blockquote></div></div>