JPMartha's Pancake

This blog is the way to brush up my poor English.

#swiftlang Going Over the Proposal SE-0014: "Constraining AnySequence.init" for Swift 2.2 💥

Updated: 2016-03-25

Target Proposal

SE-0014: Constraining AnySequence.init

Summary

Add constraints for Swift 2.2

SubSequence : SequenceType,
SubSequence.Generator.Element == Generator.Element,
SubSequence.SubSequence == SubSequence
  • Before the change:
init<S : SequenceType where S.Generator.Element == Element>(_ base: S)
  • After the change:
init<S : SequenceType where S.Generator.Element == Element,
    S.SubSequence : SequenceType,
    S.SubSequence.Generator.Element == Element,
    S.SubSequence.SubSequence == S.SubSequence>(_ base: S)

Reference

Related Changes

AnySequence Structure

Add Instance Methods

  • dropFirst(_:)
  • prefix(_:)

Reference

SequenceType Protocol

Remove Associated Types

  • Generator
  • SubSequence

Add Constraints

SubSequence : SequenceType,
SubSequence.Generator.Element == Generator.Element,
SubSequence.SubSequence == SubSequence
  • dropFirst(_: Int) -> AnySequence<Self.Generator.Element>
  • dropLast(_: Int) -> AnySequence<Self.Generator.Element>
  • prefix(_: Int) -> AnySequence<Self.Generator.Element>

Reference

AnyGenerator Structure

Add AnyGenerator Structure

Initializers

  • init(_:)
  • init(body:)

Instance Methods

  • next()

Reference

Reference

Proposals

Others