[swift-evolution] Introduce "associated_type" keyword

Ilya Belenkiy ilya.belenkiy at gmail.com
Sat Dec 5 21:40:24 CST 2015


+1 for using a distinct keyword for associated types

On Sat, Dec 5, 2015 at 9:49 PM David Waite via swift-evolution <
swift-evolution at swift.org> wrote:

> However, if a protocol wished to use type aliases not as part of a
> contract but for clarity, this would still need to be defined within the
> protocol in order for the associated types to be used in the typealias
> declarations.
>
> -DW
>
> > On Dec 5, 2015, at 7:29 PM, Dmitri Gribenko via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > On Sat, Dec 5, 2015 at 6:27 PM, Loïc Lecrenier <loiclecrenier at icloud.com>
> wrote:
> >> Great :)
> >>
> >> Also, this hasn't been explicitly discussed yet. But do you all agree
> about adding "real" typealias declarations (with the typealias keyword)
> inside protocols?
> >
> > Concrete typealieases are not requirements, so they shouldn't be
> > defined inside of a protocol.  Instead, they should be defined in the
> > protocol extension.  In fact, this has been a plan of record for some
> > time, but it wasn't implemented.
> >
> > extension SequenceType {
> >  typealias Element = Generator.Element
> > }
> >
> > Dmitri
> >
> > --
> > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151206/34fa5eff/attachment.html>


More information about the swift-evolution mailing list