<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey!<div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><blockquote type="cite" class=""><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></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></div></blockquote><div><br class=""></div><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="" style="float: none; display: inline !important;">Likewise, I find it a little deflating that I cannot express a piece of JSON in code.&nbsp;</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=""><span style="font-size: inherit;" class="">Given the *</span><b class="" style="font-size: inherit;">simplicity</b><span style="font-size: inherit;" class="">* 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></span></div></div></blockquote></div><div><br class=""></div><div>Did you just... sidestep the question? :-)</div><br class=""></div><div class="">The reason we want dictionary and array literals is that because they're needed in the real code bases, everywhere, not just for the abstract beauty of the langauge. I can certainly list many specific use cases for both array and dictionary literals, with code examples.</div><div class=""><br class=""></div><div class="">I can't think of any real use cases for the kind of literals you want, though, hence the question. (And I don't think it's worth adding just for computer science playground experiments alone.)</div><div class=""><br class=""></div><div class="">And, FWIW, JSON objects can absolutely be represented in Swift as Dictionary&lt;String, AnyObject&gt;. I even typealias that as JSONObject, and have a lot of code parsing and producing these. While TreeDictionary&lt;String, String&gt; looks superficially safer, I doubt it's worth the trouble. But again, I'd like to be proven wrong; the burden is on you to present the use cases!</div><div class=""><br class=""></div><div class="">I'm appalled by the fascination of Swift community with JSONValue-like enums. They produce the most horrible code on the parsing side, and seem to be an academic experiment in type safety. See this framework for what I believe to be the right approach to dealing with JSON in Swift:&nbsp;<a href="https://github.com/ExpressiveSwift/ExpressiveCasting" class="">https://github.com/ExpressiveSwift/ExpressiveCasting</a></div><div class=""><br class=""></div><div class="">A.</div><div class=""><br class=""></div></body></html>