I just finished reading
Traits: a new and useful template technique by Nathan C. Myers. It's an interesting and powerful approach, but I had trouble getting past the elephant in the motivating example. He wanted to be able to support streams of arbitrary character types, but for each character type he needs an "int type" that is strictly wider, in order to support a "get character" method that can return either a character or the special end-of-file value. This is a classic example of the problem of mixing status with data. That is, the "get character" method could instead return both a character and a status code, or it could throw an end-of-file exception. Compared with those solutions, the idea of traits (which required a significant extension to the supported language) is a blunderbuss solution.