Generics in a protocol-oriented design