// *** before: ***
// one word for two different things: a real alias and a placeholder
// that the conforming type has to fill in
protocol ContainerOld {
typealias Item // a placeholder
mutating func append(item: Item)
var count: Int { get }
}
// *** in version 2.2: ***
protocol Container {
associatedtype Item // clearly a placeholder
mutating func append(item: Item)
var count: Int { get }
}
struct IntBag: Container {
typealias Item = Int // and here it really is an alias
private var items = [Int]()
mutating func append(item: Int) { items.append(item) }
var count: Int { return items.count }
}