<div dir="ltr">I also find it odd that -&gt; is used for return types instead of a :. My favourite would be for = to be used for assigning to argument labels, initialization of lets, and dictionary entries, : used for types, and -&gt; used for assignment to vars. IE:<div><ol><li>Defining: `func max(x1 x1: Int, x2: Int = 0): Int` instead of `func max(x1 x1: Int, x2: Int = 0) -&gt; Int`</li><li>Using: `let positive = max(x1 = -5)` instead of `let positive = max(x1: -5)`</li><li>Assigning: `var 0 -&gt; x; 1 +-&gt; x` instead of `var x = 0; x += 1`</li><li>Entries: `let dict = [&quot;A&quot; = 1, &quot;B&quot; = 2]` instead of `let dict = [&quot;A&quot; : 1, &quot;B&quot; : 2]`</li></ol><div>However the current syntax, whilst inconsistent, is OK and therefore not worth changing.</div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 10 February 2016 at 09:45, Oliver M via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><ul style="list-style-type:none" dir="ltr">
<li style="margin:0px;font-size:12px;font-family:Menlo">A brief observation regarding variable type declarations</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">I find the colon in variable type declarations a little odd.</li>
<li style="margin:0px;font-size:12px;font-family:Menlo">Consider the following:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">var welcomeMessage: String</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">wouldn&#39;t this be cleaner simply written as</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">var welcomeMessage String</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">the documentation says to read the colon &#39;:&#39; as &quot;of type&quot; in such situations</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">but does the type &quot;String&quot; itself not imply &#39;of type String&#39;</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">Consider the colon in a function declaration:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">func sayHello(personName: String) {}</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">I would read the portion within the brackets as:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo">parameter named personName takes value of type String (because you input values when calling functions)</li>
<li style="margin:0px;font-size:12px;font-family:Menlo">with the colon reading &#39;takes value&#39; and &quot;String&quot; again reading &#39;of type String&#39;</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">I find the colon &#39;:&#39; strongly associated with function input values, and with associations [key:value pairs etc]</li>
<li style="margin:0px;font-size:12px;font-family:Menlo">but variables…you don&#39;t input anything and they are not inherently associations.</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">When coding half asleep I find myself compelled to input a value wherever I see a &#39;:&#39; and I can see myself typing something really really silly</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px"><br></li>
<li style="margin:0px;font-size:12px;font-family:Menlo">var myIndex: &quot;Int&quot; </li>
<li style="margin:0px;font-size:12px;font-family:Menlo">myIndex = 0</li></ul></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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>
<br></blockquote></div><br></div>