Generic programming in Scala
MetadataShow full item record
Generic programming is a programming methodology that aims at producing reusable code, defined independently of the data types on which it is operating. To achieve this goal, that particular code must rely on a set of requirements known as concepts. The code is only functional for the set of data types that fulfill the conditions established by its concepts. Generic programming can facilitate code reuse and reduce testing. Generic programming has been embraced mostly in the C++ community; major parts of the C++ standard library have been developed following the paradigm. This thesis is based on a study (by Garcia et al.) on generic programming applied to other languages (C#, Eiffel, Haskell, Java and ML). That study demonstrated that those languages are lacking in their support for generic programming, causing diffculties to the programmer. In this context, we investigate the new object-oriented language Scala. This particular language appealed to our interest because it implements "member types" which we conjecture to fix some of the problems of the languages surveyed in the original study. Our research shows that Scala's member types are an expressive language feature and solve some but not all of the problems identified in the original study (by Garcia et al.). Scala's members types did not resolve the problem of adding associated types to the parameter list of generic methods. This issue led to repeated constraints, implicit instantiation failure and code verbosity increase. However, Scala's member types enabled constraint propagation and type aliasing, two significantly useful generic programming mechanisms.
N'guessan, Olayinka (2006). Generic programming in Scala. Master's thesis, Texas A&M University. Texas A&M University. Available electronically from