<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="">So, I got now that I was confused.<div class=""><br class=""></div><div class="">When I saw this:<br class=""><div class=""><a href="https://github.com/apple/example-package-fisheryates/blob/master/Sources/Fisher-Yates_Shuffle.swift#L26" class="">https://github.com/apple/example-package-fisheryates/blob/master/Sources/Fisher-Yates_Shuffle.swift#L26</a></div><div class="">I was surprised as I was pretty sure you couldn't do that. But it works in 2.1 as well.</div><div class=""><br class=""></div><div class="">But it's extending a protocol, not a type.</div><div class=""><br class=""></div><div class="">but it still means that you can do what you wanted with</div><div class=""><font face="PT Mono" class="">extension SequenceType where Generator.Element == Double {</font></div><div class=""><font face="PT Mono" class="">&nbsp; func foo() -&gt; String {</font></div><div class=""><font face="PT Mono" class="">&nbsp; &nbsp; return "hello doubles!"</font></div><div class=""><font face="PT Mono" class="">&nbsp; }</font></div><div class=""><font face="PT Mono" class="">}</font></div><div class=""><font face="PT Mono" class=""><br class=""></font></div><div class="">(of course there are cases where the type is generic but it doesn't adopt a protocol with associated types to extend, so it's still plenty useful)</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 7 Dec 2015, at 12:56, Krzysztof Siejkowski &lt;<a href="mailto:krzysztof@siejkowski.net" class="">krzysztof@siejkowski.net</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;" class="">Oh, it could be so, I’m just not aware of it. I’ve tried&nbsp;Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c) with</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;" class=""><div id="bloop_customfont" style="margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="margin: 0px;" class="">extension Array where Element == Double {&nbsp;</div><div id="bloop_customfont" style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp;func foo() -&gt; String {&nbsp;</div><div id="bloop_customfont" style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return "hello doubles!"&nbsp;</div><div id="bloop_customfont" style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp;}&nbsp;</div><div id="bloop_customfont" style="margin: 0px;" class="">}</div><div id="bloop_customfont" style="margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="margin: 0px;" class="">and got</div><div id="bloop_customfont" style="margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="margin: 0px;" class="">repl.swift:1:31: error: same-type requirement makes generic parameter 'Element' non-generic</div><div id="bloop_customfont" style="margin: 0px;" class="">extension Array where Element == Double {</div><div id="bloop_customfont" style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</div><div id="bloop_customfont" style="margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="margin: 0px;" class="">Could you please point to docs / example / reference?</div><div id="bloop_customfont" style="margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="margin: 0px;" class="">All the best,</div><div id="bloop_customfont" style="margin: 0px;" class="">Krzysztof</div></div><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;" class=""><div id="bloop_sign_1449492596071899904" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"></div><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;" class=""><p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">On 7 December 2015 at 13:34:51, Davide De Franceschi via swift-evolution (<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>) wrote:</p><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><span class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""></div><div class="">I thought constraining an extension to a single type (#1) was already in 2.2?<div class="">I've seen it in a SPM example and also someone confirmed to me that it compiled</div><div class=""><br class=""></div><div class="">It went like</div><div class="">extension Array where Element == Double { // add stuff }</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 7 Dec 2015, at 12:14, Krzysztof Siejkowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;">Concerning extension constraining, it’s already doable with:</div><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;">```</div><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; margin: 0px;"><div id="bloop_customfont" class="" style="margin: 0px;">protocol DoubleProtocol {}</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">extension Double :&nbsp;DoubleProtocol&nbsp;{}</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">extension Array where Element :&nbsp;DoubleProtocol&nbsp;{</div><div id="bloop_customfont" class="" style="margin: 0px;">&nbsp; &nbsp; func onlyForDoubles() -&gt; String {</div><div id="bloop_customfont" class="" style="margin: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return "hello doubles!"</div><div id="bloop_customfont" class="" style="margin: 0px;">&nbsp; &nbsp; }</div><div id="bloop_customfont" class="" style="margin: 0px;">}</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">[1.2].onlyForDoubles() // „hello doubles!”</div><div id="bloop_customfont" class="" style="margin: 0px;">["a"].onlyForDoubles() // error: type of expression is ambiguous without more context</div><div id="bloop_customfont" class="" style="margin: 0px;">```</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">However, I personally like the idea of making a syntactic sugar for that case.</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">All the best,</div><div id="bloop_customfont" class="" style="margin: 0px;">Krzysztof</div></div><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><div id="bloop_sign_1449489930156427776" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"></div><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">On 7 December 2015 at 13:01:11, Krzysztof Siejkowski (<a href="mailto:krzysztof@siejkowski.net" class="">krzysztof@siejkowski.net</a>) wrote:</p><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""></div><div class=""><div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;"><span class="">Concerning generic typealiases, the topic is already being discussed in „Generic `typealias`s” thread:&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000132.html" class="">https://lists.swift.org/pipermail/swift-evolution/2015-December/000132.html</a>. The core Swift team approves:</span></div><div id="bloop_sign_1449489099373719808" class="bloop_sign"><div id="bloop_customfont" class="" style="margin: 0px;"><span class=""><br class=""></span></div><div id="bloop_customfont" class="" style="margin: 0px;"><span class="">&gt;&nbsp;<span class="" style="white-space: pre-wrap;">Yes, this is definitely something that I (at least) would
like to see. Patches welcome :-)</span></span></div><div id="bloop_customfont" class="" style="margin: 0px;">&gt; Chris (Lattner)</div><div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div><div id="bloop_customfont" class="" style="margin: 0px;">All the best,</div><div class="">Krzysztof</div><div class=""><br class=""></div></div><p class="airmail_on">On 7 December 2015 at 12:41:05, Tuur Anton via swift-evolution (<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>) wrote:</p><blockquote type="cite" class="clean_bq"><div class=""><div class=""><div class=""><span class="">Can you please add these features in Swift 3?</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">1. The ability to do this:</span></div><div class=""><span class="">extension Array&lt;Double&gt; {</span></div><div class=""><span class="">&nbsp; &nbsp; //extend arrays of doubles</span></div><div class=""><span class="">}</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">2. Generic typealiases:</span></div><div class=""><span class="">struct Foo&lt;T,V&gt; {</span></div><div class=""><span class="">&nbsp; &nbsp; let t: T</span></div><div class=""><span class="">&nbsp; &nbsp; let v: V</span></div><div class=""><span class="">}</span></div><div class=""><span class="">typealias IntFoo&lt;V&gt; = Foo&lt;Int,V&gt; //Error in Swift 2.1</span></div><span class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=07Gw-2BHYt-2F8PHoGiImISMGgoJA8YAyCkVdtiMuRGm10FHsuRRL5GzVAzZbDMNWwmtHrIpq77gEAQcWx0IK2x43mPjba2hnvOf8-2BH-2B-2F3GoCCmPPxbWU2xBtN02MzLZxTlEQnC3MVxbjq05bs2XZTAgCas7EUiABkkSg5PpUAvEQl4jV6fn2AMnrs3zDX9JkBRJDLElNULXHdURZFmTIAx00Q-2FMFQxc-2FR4U3aKPyp-2B5mnA-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></span></div></div></blockquote></div></div></blockquote><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=UNDxqBUDZDpZmPmXfIKeZ1UxMq-2BwsURX5ulfpb2jFAaV-2B-2BiSYuwli1bJc0iPPEcF8z3Rb4hADxklkNTLTsTBrhac31A4BXiDcNxXebEvwOnHDt3y03LmxUUOhRP2utCrR12Qxqr6hAX8Ijj-2F7-2BcNbPY0NqRxuzZdIIynKAjSMVHBDXBpnrg7yXfwXAuyUn4WDiPXi-2BTxj2dqneYEHYC9Qt-2FgTo6kM2f-2F5uzYsEKqPsY-3D" alt="" width="1" height="1" border="0" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"><span class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">_______________________________________________</span><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><span class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">swift-evolution mailing list</span><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><a href="mailto:swift-evolution@swift.org" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">swift-evolution@swift.org</a><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: 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;"></div></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=07Gw-2BHYt-2F8PHoGiImISMGgoJA8YAyCkVdtiMuRGm10EuzxlD9Fa5cDR8ibyaKt98G3Rq-2Bvao2mwZmnh7PjIj-2BDTX3gVVJAGKd92BETBJp4pSVjT8RroY6oQ1ZFsf2yy7GmP9d0jrhFE-2FIbAPtDk1xGHRuK6Oj5JKf2Cy2amKqxAOGHOVWjuVh3MC-2BItF6JMNUK31h9ARuJcCaZOXngL93Lvn-2BEM85p8HiypDk-2FeW0Ow-3D" alt="" width="1" height="1" border="0" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></span></blockquote></div></blockquote></div><br class=""></div></div></body></html>