|
Boost : |
From: David Bergman (davidb_at_[hidden])
Date: 2004-04-01 23:19:17
My 2 Öre:
First of all, I knew this was going to explode the conceptual network of the
Boost community. We all pretend/think we know exactly what the difference
is, and some of us have a fairly stable idea. None of us has a stable enough
idea to formalize it into a communicable form. Alas, this is an important
field of study, and for subsequent convergence.
Having said that, I will nevertheless try to formalize my view of these two
important notions.
I agree with David A. regarding the (presumed) use of the construct being
the vital discriminator, and that a policy (and a traits, in fact, which
would make it a quite non-generic one...) does not have to be
template-based.
In my extremely humble opinion, a trait is strongly coupled to Feature
Modeling in GP, providing a mapping from a Model for a particular Concept to
the Model-invariant parts of the Features, i.e., placing a Model in a
Feature Model. These invariant parts are mostly related types and constant
values. One can then use these invariant pieces to get to the dynamic
Features of the Concept. To be really convenient, the trait should cover all
Models for a Concept, i.e., be generic (read "templates and
specializations"...)
A policy, on the other hand, is a (compile-time or runtime) behavioral
alteration/add-on, not carrying any Concept-related information, but rather
decorating a Model for a Concept.
So, for me it is pretty easy, traits *only* describes Model-invariant parts
of Concept Features while policies furnish Models of Concepts.
Unfortunately, the words have been used more or less interchangeably in the
early GP days of C++. We here have a golden opportunity to change that...
/David
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk