There is an automatic synthesize to Equatable Conformance of types now. What if continue this tradition and add synthesize to Collection Conformance of type which has any collection property? Or the collection property of defined name for example sandbox. It will help to quickly add additional behavior to collection as from:
struct Block<Sandbox: Collection>: Collection, Comparable {
let sandbox: Sandbox
init(box: Sandbox) { sandbox = box }
var startIndex: Sandbox.Index { sandbox.startIndex }
var endIndex: Sandbox.Index { sandbox.endIndex }
subscript(position: Sandbox.Index) -> Sandbox.Element { sandbox[position] }
func index(after i: Sandbox.Index) -> Sandbox.Index { sandbox.index(after: i) }
static func < (lhs: Block<Sandbox>, rhs: Block<Sandbox>) -> Bool { lhs.sandbox.count < rhs.sandbox.count }
static func == (lhs: Block<Sandbox>, rhs: Block<Sandbox>) -> Bool { lhs.sandbox.count == rhs.sandbox.count }
}
to
struct Block<Sandbox: Collection>: Collection, Comparable {
let sandbox: Sandbox
init(box: Sandbox) { sandbox = box }
static func < (lhs: Block<Sandbox>, rhs: Block<Sandbox>) -> Bool { lhs.sandbox.count < rhs.sandbox.count }
static func == (lhs: Block<Sandbox>, rhs: Block<Sandbox>) -> Bool { lhs.sandbox.count == rhs.sandbox.count }
}
Now conforming to Collection protocol is hidden under the hood.