<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="">Hi Andrey and Laurent,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14 Apr 2016, at 19:23, Andrey Tarantsov <<a href="mailto:andrey@tarantsov.com" class="">andrey@tarantsov.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: -webkit-standard; font-style: normal; font-variant-caps: 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;">Can you please give us a few real-world examples where initializing a nontrivial tree-like data structure in code would be useful?</div><div class="" style="font-family: -webkit-standard; font-style: normal; font-variant-caps: 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><div class="" style="font-family: -webkit-standard; font-style: normal; font-variant-caps: 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;">It's an honest question — I have never felt the need in my life, and I always preferred to move the data into something like a bundled json or CSV, rather than providing it in code.</div></div></blockquote></div><br class=""></div><div class="">I suppose we always prefer to move *<b class="">all</b>* data into databases or files with dedicated data formats, *<b class="">including</b>* arrays, strings, dictionaries, etc. Sure. But it would be rather underwhelming if you could not also just instantiate an array or a string from a literal.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 14 Apr 2016, at 19:33, L Mihalkovic <<a href="mailto:laurent.mihalkovic@gmail.com" class="">laurent.mihalkovic@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">I’d rather the language do NOT make it easy to have complex literals initializations</span></div></blockquote></div><div class=""><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;"><br class=""></span></div></div><div class=""><span class="" style="float: none; display: inline !important;">I agree, except, something like `<font face="Menlo" size="2" class="">[1, [2]]</font>` doesn’t immediately strike me by its complexity. Likewise, I find it a little deflating that I cannot express a piece of JSON in code. My example structures do allow you to write:</span></div><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="float: none; display: inline !important;"><div style="margin: 0px; line-height: normal; color: rgb(73, 162, 210);" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><</span><span style="font-variant-ligatures: no-common-ligatures;" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">, </span><span style="font-variant-ligatures: no-common-ligatures;" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">> =</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" face="Menlo" class="">[</font></span></div><div style="margin: 0px; line-height: normal; color: rgb(100, 150, 29);" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">"name"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures" class="">"Johnny Appleseed"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(100, 150, 29);" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">"address"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: [</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(100, 150, 29);" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">"streetAddress"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures" class="">"21 2nd Street"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(100, 150, 29);" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">"city"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures" class="">"New York"</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>]</font></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" face="Menlo" class="">]</font></span></div><div style="font-size: inherit;" class=""><br class=""></div></span></div><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">… but I cannot get rid of that prefix operator without the additional literal-convertible protocols. Given the *<b class="">simplicity</b>* of these structures, it seems it should not be beyond Swift to represent them in code with ease and elegance. And to begin with, all we need are those couple of protocols.</span></div><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;"><br class=""></span></div><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">milos</span></div></body></html>