
From: "Hurd, Matthew" <hurdm@sig.com> [...]
It would be nice if something new like "aspect class" or some such could
Interesting name! I second your opinion in many ways. I don't think that differentiating between traits and policy makes too much sense or really necessary. As for now to me, they both are parts of the same concept. The idea is that a class can define an API specification. The user is responsible for implementing the API and supplying the implementation to the class as a template parameter. Traditionally an API is not a set of just behaviors or just data structures. It is a combination of both and it doesn't have to be stateless. So what's so unique about API's from the OOP standpoint especially. Well, an API as such cannot be INSTANTIATED. It just EXISTs as a set of rules, etc. It is like namespaces in C++. You cannot instantiate a namespace! You can instantiate data types defined by the API though. So to me, both traits and policies are sort of interchangeable namespaces. Perhaps my view is too simplistic. I sometimes do something like this template< typename MatrixApi > struct equation_system_solver {...}; struct api { private: //** note private here api(); }; struct my_vector_api : api {...}; template< typename VectrorApi > struct my_matrix_api : api {...}; equation_system_solver< my_matrix_api<my_vector_api> > s; Eugene