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

Dmitri Gribenko gribozavr at gmail.com
Mon Apr 25 03:07:05 CDT 2016

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.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-evolution mailing list