<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Howard, there is an ongoing discussion about using equal sign instead of a colon in dictionary literals.</div><div class=""><br class=""></div>Anyway, I'm -1 on all of this. Colons explicitly and successfully separate name from its type. What happens if you type <div class=""><br class=""></div><div class=""><blockquote type="cite" class="">let String String</blockquote></div><div class=""><br class=""></div><div class="">in your scenario? How can one distinguish what's what?<div class=""><div class=""><br class=""></div><div class="">Besides, Oliver and Howard, your only argument is that "you find it odd". To convince me (and many others, I presume), you'd need to provide a stronger argument.<div class=""><br class=""></div><div class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><font color="#929292" class=""><br class="Apple-interchange-newline">Pozdrawiam – Regards,</font></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><font color="#929292" class="">Adrian Kashivskyy</font></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Wiadomość napisana przez Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> w dniu 10.02.2016, o godz. 01:28:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I also find it odd that -> 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 -> used for assignment to vars. IE:<div class=""><ol class=""><li class="">Defining: `func max(x1 x1: Int, x2: Int = 0): Int` instead of `func max(x1 x1: Int, x2: Int = 0) -> Int`</li><li class="">Using: `let positive = max(x1 = -5)` instead of `let positive = max(x1: -5)`</li><li class="">Assigning: `var 0 -> x; 1 +-> x` instead of `var x = 0; x += 1`</li><li class="">Entries: `let dict = ["A" = 1, "B" = 2]` instead of `let dict = ["A" : 1, "B" : 2]`</li></ol><div class="">However the current syntax, whilst inconsistent, is OK and therefore not worth changing.</div></div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"> -- Howard.<br class=""></div></div>
<br class=""><div class="gmail_quote">On 10 February 2016 at 09:45, Oliver M via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px;" class=""><ul style="list-style-type:none" dir="ltr" class="">
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">A brief observation regarding variable type declarations</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">I find the colon in variable type declarations a little odd.</li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">Consider the following:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">var welcomeMessage: String</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">wouldn't this be cleaner simply written as</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">var welcomeMessage String</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">the documentation says to read the colon ':' as "of type" in such situations</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">but does the type "String" itself not imply 'of type String'</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">Consider the colon in a function declaration:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">func sayHello(personName: String) {}</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">I would read the portion within the brackets as:</li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">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" class="">with the colon reading 'takes value' and "String" again reading 'of type String'</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">I find the colon ':' strongly associated with function input values, and with associations [key:value pairs etc]</li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">but variables…you don't input anything and they are not inherently associations.</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">When coding half asleep I find myself compelled to input a value wherever I see a ':' and I can see myself typing something really really silly</li>
<li style="margin:0px;font-size:12px;font-family:Menlo;min-height:14px" class=""><br class=""></li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">var myIndex: "Int" </li>
<li style="margin:0px;font-size:12px;font-family:Menlo" class="">myIndex = 0</li></ul></div></div><br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></div></div></body></html>