The development of complex software requires the implementation of functions over a variety of recursively defined data structures. The design (and modeling) of structures can itself be difficult, but complex data can lead to even more complex functions. In this paper, we introduce a declarative form of traversal-based generic programming that modularizes functions over a structure using function-objects. Our approach is supported by a library and set of generative tools, collectively called DemeterF, which are used to implement adaptive functions. While our reflective traversals provide maximum flexibility, DemeterF can weave the same function classes into traversals that perform as efficiently as hand-coded methods.
Bryan Chadwick, Karl J. Lieberherr