<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=""><div><blockquote type="cite" class=""><div class="">On Apr 15, 2016, at 1:29 AM, Milos Rankovic <<a href="mailto:milos@milos-and-slavica.net" class="">milos@milos-and-slavica.net</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><div class="">On 15 Apr 2016, at 03:22, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:</div></blockquote></div></div></blockquote></div><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=""><blockquote type="cite" class=""><div class="">Your JSON literal example is already pretty well modeled by simply making a JSONValue type that conforms to all the literal protocols. It is completely unclear why you would even want to model this with some generic Tree structure. </div></blockquote>Because JSON has the structure of a tree. A dictionary of the type `[String:AnyObject]` does not express that structure even if at run-time it turns out that some of those any-objects are themselves dictionaries. `Tree<String, JSONValue>`, in contrast, precisely expresses the structure of JSON objects.</div></div></div></blockquote><div><br class=""></div>No, it's actually a very strange way to model it. The JSONValue type needs to be able to embed both JSON arrays and JSON objects, so if you represent a JSON object as a DictionaryTree<String, JSONValue>, you'll end up with two different ways to represent { "x" : { "y" : 1 } }. It's much better to use the "flat" representation of Dictionary<String, JSONValue> and allow the JSONValue enum's natural recursiveness to express nested objects.</div><div><br class=""></div><div>John.</div></body></html>