<div dir="ltr">Thats a small but huge improvement :) </div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 6:58 PM, Chris Lattner <span dir="ltr">&lt;<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>You’re completely right, but we don’t need to change the swift language to fix that.  As of 3f19714, which I just pushed, we now emit this error message (which includes a fixit hint to insert the colon):</div><div><br></div><div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco">t.swift:2:33: <span style="color:#c33720">error: </span>use [:] to get an empty dictionary literal</div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco">var distanceCache: [Int: Int] = []</div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(52,189,38)">                                ^</div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco">                                 :</div></div><div><br></div><div>instead of:</div><div><br></div><div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco">t.swift:2:33: <span style="color:#c33720">error: </span>contextual type &#39;[Int : Int]&#39; cannot be used with array literal</div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco">var distanceCache: [Int: Int] = []</div><div style="margin:0px;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(52,189,38)">                                ^~</div></div><div><br></div><div>That should address the problem, thanks for pointing this out!</div><div><br></div><div>-Chris</div><br><div><blockquote type="cite"><div><div class="h5"><div>On Jan 5, 2016, at 4:51 AM, James Campbell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">The problem for me is that is so counter intuitive I didn&#39;t even know you could do that.</div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Tue, Jan 5, 2016 at 12:50 PM, Jeremy Pereira<span> </span><span dir="ltr">&lt;<a href="mailto:jeremy.j.pereira@googlemail.com" target="_blank">jeremy.j.pereira@googlemail.com</a>&gt;</span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I don’t understand what the problem is<br><span><br>&gt; On 5 Jan 2016, at 12:39, James Campbell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>&gt;<br>&gt; See this code:<br>&gt; var distanceCache: [Int: Int] = Dictionary&lt;Int, Int&gt;()<br>&gt;<br>&gt; It is very long and tedious to write especially if what I am storing changes.<br>&gt;<br>&gt; I propose we be allowed to do the following:<br>&gt; var distanceCache: [Int: Int] = []<br><br></span>You can do<br><br>var distanceCache: [Int: Int] = [:]<br><br>Also<br><br>var distanceCache2 = [Int: Int]()<br><span><br><br>&gt; Perhaps this dictionary syntax is just confusing and it was a bad idea to make it the same as an array. Most languages use &quot;{&quot; so why did swift choose to share &quot;[&quot; with arrays and dictionaries.<br><br></span>It’s not the same, you need the colons inside. I imagine that braces were discarded on the grounds that it would confuse the compiler with respect to closures, for example<br><br>var myClosure = {} // is a variable of type () -&gt; ()<br><span><br><br>&gt;<br>&gt; --<br>&gt;  Wizard<br>&gt;<span> </span><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a><br>&gt;<span> </span><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a><br></span>&gt;  _______________________________________________<br>&gt; swift-evolution mailing list<br>&gt;<span> </span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>&gt;<span> </span><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><br clear="all"><div><br></div>--<span> </span><br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RC5Cq0zAxCHc1sM9Uy3-2BojrrUAw-2F96zH69NULNHPvCvYjSfxkVJuM0aqESTM-2BsDSHvPOtv1ngtNzvn6FRKXwixNK-2FzEq4E6jd20hmO8xBql58qIcwP3iYFqQ-2FMJTkOEK72aQOVaKRhVYByYzid8kucNvQzblYIZUjaPw1Vb29zWm7RdzuqO9oH9m-2Bryy4cuckPklb6-2FoZCpkVKnrRHjtmtWyLs5CtKAeq5GYdB69J0A-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><span class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div>+44 7523 279 698</div></div></div></div></div></div>
</div>