Two Papers on Generic Programming
I understand the syntactic application of generics as a language feature, but Ole Begemann's post on protocols convinced me there's still a lot of gold to be mined in their conceptual underpinnings.
Towards that, I've found these two papers particularly enlightening:
An example chunk of wisdom from Fundamentals (lightly edited for conformance with Swift syntax):
The critical insight which produced generic programming is that highly reusable components must be programmed assuming a minimal collection of [protocols], and that the [protocols] used must match as wide a variety of concrete program structures as possible.
Thus, successful production of a generic component is not simply a matter of identifying the minimal requirements of an arbitrary type or algorithm – it requires identifying the common requirements of a broad collection of similar components.
1: Presented at the "First International Joint Conference of the International Symposium on Symbolic and Algebraic Computations and Applied Algebra, Algebraic Algorithms, and Error Correcting Codes". Ladies and gentlemen, that is how you name a goddamned conference! ↩︎