<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14 Apr 2016, at 21:36, 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="">No, you just need Tree to conform to both ArrayLiteralConvertible and IntegerLiteralConvertible, and it implements the latter by building a Value out of it.</span></div></blockquote></div><br class=""><div class="">You mean this:</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="">public</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><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=""> IntTree {</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=""> Leaf(</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=""><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=""> Branches([</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">IntTree</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="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">IntTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">ArrayLiteralConvertible</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="">public</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(arrayLiteral elements: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">IntTree</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="">self</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Branches</span><span style="font-variant-ligatures: no-common-ligatures" class="">(elements)</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 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="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">IntTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">IntegerLiteralConvertible</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="">public</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(integerLiteral value: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">IntegerLiteralType</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="">self</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="">(value)</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 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;" 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" class=""> tree: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">IntTree</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = [[], </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">, [</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [[</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">6</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">7</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">8</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">9</span><span style="font-variant-ligatures: no-common-ligatures" class="">]]]</span></font></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">you'll simply have to make your Tree less generic</div></div></blockquote></div><div class=""><br class=""></div><div class="">Yep, that’s the rub… With generic trees you can express yourself freely, whether you feel like:</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="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> SpriteKit</span></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;" 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" class=""> actionTree: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">SKAction</span><span style="font-variant-ligatures: no-common-ligatures" class="">> = [</span></font></div><div style="margin: 0px; line-height: normal; color: rgb(145, 84, 15);" 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="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">waitForDuration</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</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=""><span class="Apple-tab-span" style="white-space:pre">        </span>[</font></span></div><div style="margin: 0px; line-height: normal; color: rgb(145, 84, 15);" 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="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">fadeInWithDuration</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</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: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">scaleTo</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">, duration: </span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</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=""><span class="Apple-tab-span" style="white-space:pre">        </span>],</font></span></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: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">playSoundFileNamed</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"TaDa"</span><span style="font-variant-ligatures: no-common-ligatures" class="">, waitForCompletion: </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">false</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="">… or:</div><div class=""><br class=""></div><div class=""><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: rgb(200, 172, 229);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> johnny: </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="">JSONValue</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 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=""><br class=""></div><div class="">I’d just love to get rid of that prefix operator…</div><div class=""><br class=""></div><div class="">milos</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>