<div dir="ltr">See this code:<div>







<p class=""><span class="">var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">] = </span><span class="">Dictionary</span><span class="">&lt;</span><span class="">Int</span><span class="">, </span><span class="">Int</span><span class="">&gt;()</span></p><div>It is very long and tedious to write especially if what I am storing changes.</div><div><br></div><div>I propose we be allowed to do the following:</div><div>







<p class=""><i><span class="">var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">] = []</span></i></p><p class="">If this isn&#39;t possible then I wouldn&#39;t mind having some way of telling the compiler to auto create it like so:</p><p class="">







</p><p class=""><i><span class="">var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">] ()</span></i></p><p class=""><span class="">or</span></p><p class="">







</p><p class=""><i><span class="">var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">] = new </span><span class="">Dictionary</span></i></p><p class="">or even:</p><p class=""><i><span class="">var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">] = auto</span></i></p><p class=""><i><span class="">auto var</span><span class=""> distanceCache: [</span><span class="">Int</span><span class="">: </span><span class="">Int</span><span class="">]</span></i><i><span class=""><br></span></i></p><p class=""><span class="">(auto short for auto create)</span></p><p class=""><span class=""><br></span></p><p class="">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></p></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></div>