Datatype-generic programming (DGP) is the next step beyond abstracting over types using parametric polymorphism, which is often called "genericity" in object-oriented languages. However, unlike genericity, DGP has not received much attention in the OO community. Nonetheless, in the context of functional languages, it has proven to make programs more robust with respect to changes in the type structure, as well as in many other applications, such as type-safe XML processing and marshalling. To carry these strengths over to an OO language, we present an extensible library for lightweight DGP in Scala, based on an existing lightweight approach in Haskell. We discuss the challenges in developing and using our library, and explore ways to overcome them.
['Adriaan Moors', 'Frank Piessens', 'Wouter Joosen']
An object-oriented approach to datatype-generic programming