Why did Swift developers decide to make the syntax as follows:
protocol Container { associatedtype Item mutating func append(_ item: Item) var count: Int { get } subscript(i: Int) -> Item { get } }
Instead of this:
protocol Container<Item> { mutating func append(_ item: Item) var count: Int { get } subscript(i: Int) -> Item { get } }
The latter seems to be much more consistent with other uses of generics in Swift.
source share