<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 John and Brent, <div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14 Apr 2016, at 22:22, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: -webkit-standard; font-size: inherit; 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; float: none; display: inline !important;" class="">multiple-conformance idea doesn't work</span></div></blockquote></div><div class=""><br class=""></div><div class="">The idea is not multiple-conformance (or overloading), but multiple (two) initialisers required by the literal-convertible protocols:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> TreeLiteralConvertible {</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(200, 172, 229);" 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="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> LeafValue</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.LeafValue...)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font size="2" face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures" 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><div class=""><br class=""></div><div class="">… and:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> DictionaryTreeLiteralConvertible {</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(200, 172, 229);" class=""><font face="Menlo" size="2" 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="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Key</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(200, 172, 229);" class=""><font face="Menlo" size="2" 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="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> LeafValue</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.LeafValue...)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: (Key, </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures" class="">)...)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">}</font></span></div></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><span class="" style="font-size: inherit; display: inline !important;">Note that all of your examples rely not just on recursion but on heterogeneous recursion</span></blockquote><br class=""></div><div class="">The crux of the matter is not heterogeneity in general, but of the leaf value in particular. This is what Brent is addressing. All my examples, save one, had a uniform leaf value type (even the Tree<SKAction> example). The one exception is my second JSON example. There I did not post the lift operator overload as you can probably imagine it. Minimally:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> JSONValue {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Text(</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Integer(</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">}</font></span></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ◊ <Key> (leaf: </span><span style="font-variant-ligatures: no-common-ligatures" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span><span style="font-variant-ligatures: no-common-ligatures" class="">Key</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSONValue</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">> {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Leaf</span><span style="font-variant-ligatures: no-common-ligatures" class="">(.</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Text</span><span style="font-variant-ligatures: no-common-ligatures" class="">(leaf))</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">}</font></span></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ◊ <Key> (leaf: </span><span style="font-variant-ligatures: no-common-ligatures" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span><span style="font-variant-ligatures: no-common-ligatures" class="">Key</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSONValue</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">> {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Leaf</span><span style="font-variant-ligatures: no-common-ligatures" class="">(.</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Integer</span><span style="font-variant-ligatures: no-common-ligatures" class="">(leaf))</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">}</font></span></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> johnny: </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span><span style="font-variant-ligatures: no-common-ligatures" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span><span style="font-variant-ligatures: no-common-ligatures" class="">JSONValue</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">> =</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">[</font></span></div><div style="margin: 0px; line-height: normal; color: rgb(100, 150, 29);" class=""><font face="Menlo" size="2" 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 face="Menlo" size="2" 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="">"age"</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; color: #ff2600" class="">25</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 face="Menlo" size="2" 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 face="Menlo" size="2" 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="">"house_number"</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; color: #ff2600" class="">21</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 face="Menlo" size="2" 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="">"street"</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="">"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 face="Menlo" size="2" 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 face="Menlo" size="2" 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 face="Menlo" size="2" class="">]</font></span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Notice in particular how much contextual information you are getting from the expected return type. Still though, as Brent, points out, this won’t work with the two literal-convertable protocols. Nevertheless, I’d be very happy if they could be added as a first step since I suspect that would be the easiest option and one that would still allow for all my examples so far to work without the lift operator; all except this `JSONValue` example.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">milos</div></div></body></html>