<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
> However, I personally like the idea of making a syntactic sugar for that case.<div><br /></div><div>Thanks! I didn't know I could do it like that.</div><div>Yeah, someone please add that syntactic sugar. That would be really cool. Otherwise my namespace gets polluted with that DoubleProtocol, minor drawback :)<br /><br />
--
<br />
Securely sent with Tutanota. Claim your encrypted mailbox today!
<br />
<a href="https://tutanota.com" target="_blank">https://tutanota.com</a><br /><br />7. Dec 2015 13:14 by <a href="mailto:krzysztof@siejkowski.net" target="_blank">krzysztof@siejkowski.net</a>:<br /><br /><blockquote class="tutanota_quote" style="border-left: 1px solid #93A3B8; padding-left: 10px; margin-left: 5px;"><div id="bloop_customfont" style="font-family: "helvetica" , "arial" ; font-size: 13px ; color: rgba( 0 , 0 , 0 , 1.0 ) ; margin: 0px">Concerning extension constraining, it’s already doable with:</div><div id="bloop_customfont" style="font-family: "helvetica" , "arial" ; font-size: 13px ; color: rgba( 0 , 0 , 0 , 1.0 ) ; margin: 0px"><br /></div><div id="bloop_customfont" style="font-family: "helvetica" , "arial" ; font-size: 13px ; color: rgba( 0 , 0 , 0 , 1.0 ) ; margin: 0px">```</div><div id="bloop_customfont" style="margin: 0px"><div id="bloop_customfont" style="margin: 0px">protocol DoubleProtocol {}</div><div id="bloop_customfont" style="margin: 0px"><br /></div><div id="bloop_customfont" style="margin: 0px">extension Double : DoubleProtocol {}</div><div id="bloop_customfont" style="margin: 0px"><br /></div><div id="bloop_customfont" style="margin: 0px">extension Array where Element : DoubleProtocol {</div><div id="bloop_customfont" style="margin: 0px"> func onlyForDoubles() -> String {</div><div id="bloop_customfont" style="margin: 0px"> return "hello doubles!"</div><div id="bloop_customfont" style="margin: 0px"> }</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br /></div><div id="bloop_customfont" style="margin: 0px">[1.2].onlyForDoubles() // „hello doubles!”</div><div id="bloop_customfont" style="margin: 0px">["a"].onlyForDoubles() // error: type of expression is ambiguous without more context</div><div id="bloop_customfont" style="margin: 0px">```</div><div id="bloop_customfont" style="margin: 0px"><br /></div><div id="bloop_customfont" style="margin: 0px">However, I personally like the idea of making a syntactic sugar for that case.</div><div id="bloop_customfont" style="margin: 0px"><br /></div><div id="bloop_customfont" style="margin: 0px">All the best,</div><div id="bloop_customfont" style="margin: 0px">Krzysztof</div></div> <br /> <div id="bloop_sign_1449489930156427776" class="bloop_sign"></div> <br /><p class="airmail_on">On 7 December 2015 at 13:01:11, Krzysztof Siejkowski (<a href="mailto:krzysztof@siejkowski.net" target="_blank">krzysztof@siejkowski.net</a>) wrote:</p> <blockquote class="thunderbird_quote" style="border-left: 1px solid #93a3b8 ; padding-left: 10px ; margin-left: 5px"><div style="word-wrap: break-word"><div></div><div>
</div></div></blockquote>
<div id="bloop_customfont" style="font-family: "helvetica" , "arial" ; font-size: 13px ; color: rgba( 0 , 0 , 0 , 1.0 ) ; margin: 0px">
Concerning generic typealiases, the topic is already being
discussed in „Generic `typealias`s” thread: <a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000132.html" target="_blank">https://lists.swift.org/pipermail/swift-evolution/2015-December/000132.html</a>.
The core Swift team approves:</div>
<div id="bloop_sign_1449489099373719808" class="bloop_sign">
<div id="bloop_customfont" style="margin: 0px"><br /></div>
<div id="bloop_customfont" style="margin: 0px">
> <span style="white-space: pre-wrap">Yes, this is
definitely something that I (at least) would like to see. Patches
welcome :-)</span></div>
<div id="bloop_customfont" style="margin: 0px">> Chris
(Lattner)</div>
<div id="bloop_customfont" style="margin: 0px"><br /></div>
<div id="bloop_customfont" style="margin: 0px">All the best,</div>
<div>Krzysztof</div>
<div><br /></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" target="_blank">swift-evolution@swift.org</a>)
wrote:</p>
<blockquote class="thunderbird_quote" style="border-left: 1px solid #93a3b8 ; padding-left: 10px ; margin-left: 5px">
<div>
<div>
<div>Can you please add these features in Swift
3?</div>
<div><br /></div>
<div>1. The ability to do this:</div>
<div>extension Array<Double> {</div>
<div> //extend arrays of doubles</div>
<div>}</div>
<div><br /></div>
<div>2. Generic typealiases:</div>
<div>struct Foo<T,V> {</div>
<div> let t: T</div>
<div> let v: V</div>
<div>}</div>
<div>typealias IntFoo<V> = Foo<Int,V> //Error in
Swift 2.1</div>
<img src="graphics/ion-alert-circled.svg" alt="" width="1" height="1" border="0" style="height: 1px ; width: 1px ; border-width: 0 ; margin-top: 0 ; margin-bottom: 0 ; margin-right: 0 ; margin-left: 0 ; padding-top: 0 ; padding-bottom: 0 ; padding-right: 0 ; padding-left: 0" />
_______________________________________________<br />
swift-evolution mailing list<br />
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br />
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br /></div>
</div>
</blockquote>
</blockquote></div> </body>
</html>