[swift-evolution] Introduce "associated_type" keyword

Dmitri Gribenko gribozavr at gmail.com
Sat Dec 5 20:29:30 CST 2015


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>*/


More information about the swift-evolution mailing list