I've considered runtime modules, but that requires a quite a bit of design to figure out what the scope of the module functionality would be, and how the modules would interact with one another. My experience is that this type of code often ends up being application specific, so it's hard to make general assumptions about how it will be used. With the template approach, you can easily customize the generated code to fit whatever you're doing. The downside is that it's not really possible to inject templated functionality into an existing projects.