| ML 2007
||START Conference Manager
Practical generic programming in OCaml
The 2007 ACM SIGPLAN Workshop on ML (ML 2007)
Freiburg, Germany, October 5, 2007
We describe deriving, a system of extensible generic functions for OCaml implemented as a preprocessor and supporting library. We argue that generating code from type-definitions has significant advantages over a combinatorial approach, taking serialisation as an example application: our generate-your-boilerplate design results in a system that is easy to use, has comprehensive coverage of types and handles cyclic values without imposing any burden on the user. The specialization principle allows a user to supply an alternative implementation of a generic function at a particular type; we show how this can lead to dramatically improved performance in the serialisation task without the user writing a single line of serialisation code.