<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 May 24, 2017, at 5:11 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">On Wed, May 24, 2017 at 3:32 PM, David Sweeris via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">So, I’m working on a type, and would like to make it conform to `ExpressibleByArrayLiteral`. The thing is, I don’t actually care what type `Element` is as long as it conforms to `FixedWidthInteger` and `UnsignedInteger`. I tried writing this:<div class=""><div style="margin:0px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">public</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">init</span><span style="font-variant-ligatures:no-common-ligatures" class=""> <U: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">FixedWidthInteger</span><span style="font-variant-ligatures:no-common-ligatures" class=""> & </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">UnsignedInteger</span><span style="font-variant-ligatures:no-common-ligatures" class="">> (arrayLiteral elements: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(79,129,135)" class="">U</span><span style="font-variant-ligatures:no-common-ligatures" class="">...) { </span>… }</div></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class="">But Xcode says my type doesn’t conform to `ExpressibleByArrayLiteral` unless I add an init that takes a concrete type:</span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><div style="margin:0px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">public</span><span style="font-variant-ligatures:no-common-ligatures" class=""> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(186,45,162)" class="">init</span><span style="font-variant-ligatures:no-common-ligatures" class="">(arrayLiteral elements: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(112,61,170)" class="">UInt</span><span style="font-variant-ligatures:no-common-ligatures" class="">...) {</span><font face="Menlo" class=""> </font><font face="Menlo" class="">…</font> }</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="">Does anyone else think the generic init should to be able to satisfy `ExpressibleByArrayLiteral` (especially since `UInt` meets the conformance requirements)?</span></div></span></div></div></blockquote><div class=""><br class=""></div><div class="">Your type needs to be generic.</div></div></div></div></div></blockquote><br class=""></div><div>It already is… I just don’t want to restrict it to being initialized from array literals containing that same generic type.</div><div><br class=""></div><div>- Dave Sweeris</div></body></html>