Doug wrote this in the Completing Generics manifesto, under "Minor
extensions":
> **Arbitrary requirements in protocols*
Currently, a new protocol can inherit from other protocols, introduce new
> associated types, and add new conformance constraints to associated types
> (by redeclaring an associated type from an inherited protocol). However,
> one cannot express more general constraints. Building on the example from
> “Recursive protocol constraints”, we really want the element type of a
> Sequence’s SubSequence to be the same as the element type of the Sequence,
> e.g.,
>
protocol Sequence {
> associatedtype Iterator : IteratorProtocol
> …
> associatedtype SubSequence : Sequence where
> SubSequence.Iterator.Element == Iterator.Element
> }
>
+1.
To make it into Swift 3, would this feature require a proposal of its own?
How feasible would it be to implement on top of the current system?
Jacob
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution