[swift-evolution] [swift-evolution-announce] [Review] SE-0142: Permit where clauses to constrain associated types

Matt Whiteside mwhiteside.dev at gmail.com
Sat Sep 24 16:39:09 CDT 2016


I also wanted to throw in support for Drew’s addendum below.  It’s a feature I’ve come across the need more than once, and I don’t even write a lot of swift.

-Matt

> One thing I would like to see (perhaps out of scope for this proposal) is the natural extension for generic parameters:
> 
> struct Box<T> {
>     var t: T
> }
> 
> extension Box where T == Int { //error: Same-type requirement makes generic parameter T non-generic
> }
> 
> There is a great deal of overlap between associated types and generic parameters, and it seems to me that it would be favorable to allow `==` with both generic parameter operands and associatedtype operands for consistency.
> 
> Drew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160924/5bccf4aa/attachment.html>


More information about the swift-evolution mailing list