If you look at the source for Sequence
<https://github.com/apple/swift/blob/master/stdlib/public/core/Sequence.swift#L325>,
you can see that the protocol declares a ton of methods and properties; but in
fact, all you need to provide is Element, Iterator and makeIterator. The rest
comes for free, but can be specialized.
Of course, I don't want to work more than I need to. However, I find that I'm
having trouble figuring out what I get for free when I implement a protocol. In
principle, I like conditional conformances and synthesized implementation of
protocol methods, but I find that they both make it harder to figure out what I
need to implement, and what are going to be the performance characteristics of
methods that I choose to not implement.
I feel like this is perceived to be a problem by a lot of other people. Is
there anything that can make it easier to figure out what you get for free?
Félix
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution