<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="">You’re completely right, but we don’t need to change the swift language to fix that. &nbsp;As of&nbsp;3f19714, which I just pushed, we now emit this error message (which includes a fixit hint to insert the colon):</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco;" class="">t.swift:2:33: <span style="font-variant-ligatures: no-common-ligatures; color: #c33720" class="">error: </span>use [:] to get an empty dictionary literal</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco;" class="">var distanceCache: [Int: Int] = []</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(52, 189, 38);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco;" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :</div></div><div class=""><br class=""></div><div class="">instead of:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco;" class="">t.swift:2:33: <span style="font-variant-ligatures: no-common-ligatures; color: #c33720" class="">error: </span>contextual type '[Int : Int]' cannot be used with array literal</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco;" class="">var distanceCache: [Int: Int] = []</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Monaco; color: rgb(52, 189, 38);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^~</div></div><div class=""><br class=""></div><div class="">That should address the problem, thanks for pointing this out!</div><div class=""><br class=""></div><div class="">-Chris</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 5, 2016, at 4:51 AM, James Campbell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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="">The problem for me is that is so counter intuitive I didn'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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Tue, Jan 5, 2016 at 12:50 PM, Jeremy Pereira<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:jeremy.j.pereira@googlemail.com" target="_blank" class="">jeremy.j.pereira@googlemail.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><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 class=""><span class=""><br class="">&gt; On 5 Jan 2016, at 12:39, James Campbell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">&gt;<br class="">&gt; See this code:<br class="">&gt; var distanceCache: [Int: Int] = Dictionary&lt;Int, Int&gt;()<br class="">&gt;<br class="">&gt; It is very long and tedious to write especially if what I am storing changes.<br class="">&gt;<br class="">&gt; I propose we be allowed to do the following:<br class="">&gt; var distanceCache: [Int: Int] = []<br class=""><br class=""></span>You can do<br class=""><br class="">var distanceCache: [Int: Int] = [:]<br class=""><br class="">Also<br class=""><br class="">var distanceCache2 = [Int: Int]()<br class=""><span class=""><br class=""><br class="">&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 "{" so why did swift choose to share "[" with arrays and dictionaries.<br class=""><br class=""></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 class=""><br class="">var myClosure = {} // is a variable of type () -&gt; ()<br class=""><span class=""><br class=""><br class="">&gt;<br class="">&gt; --<br class="">&gt;  Wizard<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><a href="mailto:james@supmenow.com" class="">james@supmenow.com</a><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><a href="tel:%2B44%207523%20279%20698" value="+447523279698" class="">+44 7523 279 698</a><br class=""></span>&gt;&nbsp; _______________________________________________<br class="">&gt; swift-evolution mailing list<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><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=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space">&nbsp;</span><br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><span style="font-size: 16px; line-height: 19.2px;" class=""></span><span style="font-size: 12.8px;" class="">&nbsp;Wizard</span><br class=""></div><div class=""><a href="mailto:james@supmenow.com" target="_blank" class="">james@supmenow.com</a></div><div class="">+44 7523 279 698</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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: 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; float: none; display: inline !important;" class="">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; 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=""><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; 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="">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; 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=""><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; 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="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>