[swift-evolution] [Proposal] More Powerful Constraints for Associated Types

Dave Abrahams dabrahams at apple.com
Mon Apr 25 17:05:50 CDT 2016


on Mon Apr 25 2016, Dmitri Gribenko <swift-evolution at swift.org> wrote:

> On Sun, Apr 24, 2016 at 1:34 PM, David Hart via swift-evolution
> <swift-evolution at swift.org> wrote:
>> Currently, associated type declarations can only express simple inheritance
>> constraints and not the more sophisticated constraints available to generic
>> types with the where expression. Some designs, including many in the
>> Standard Library, require more powerful constraints for associated types to
>> be truly elegant. For example, the SequenceType protocol can be declared as
>> follows:
>
> I completely support this.  This feature will unblock many
> improvements in the standard library.  Currently users of some
> protocols have to carry extra constraints in their own type
> signatures, but we should be able to hoist these constraints into the
> protocol definiton.

+1

-- 
Dave



More information about the swift-evolution mailing list