Boost logo

Boost :

Subject: Re: [boost] [Advice] Documenting the "refined by" relation for concepts
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-06-13 18:00:13


On 6/13/15 1:12 PM, Louis Dionne wrote:
> Dear all,
>
> When documenting a concept in a generic library, it is common to include what
> this concept is a "refinement of", i.e. which other concept(s) it specializes.
> For example, see the ForwardContainer concept from the SGI STL [1], which
> is a refinement of the Container concept.
>
> I find documenting this relation very useful. However, I have never seen the
> reverse relation of being "refined by" documented. It has been suggested to
> me [2] that Hana should document this "refined by" relation. Having never
> seen it done before, I'd like to know what the seasoned generic library
> writers think about it. The possibilities I personally see are
>
> 1. It's just not useful, and that's why it's not done
True - the dependency relation is that the "derived concept" depends
upon the "base concept" but not the other way around. It's exactly
analogous to a class hierarchy. In fact, if you use Boost Concept
Checking library (as you should be) You'll find that a "refinement of"
concept is defined as a C++ base type and a "refined by" concept is
defined as a C++ derived class. Just as a base class cannot specify
anything about anything derived from it - a "refinement of" concept
can't say anything about the "refined by" concepts other than that which
is already described by the "base" concept. This is touched upon in my
"Advice - Type Requirements" in the boost library incubator.

> 2. It's actually harmful, because you can't predict who is going to
> refine a concept

Also true - It could never be accurate.

However, it's common for documentation of at concept to contain a
section named "Models" which are basically classes which follow (model)
the concept.

I'm sympathetic to the question though. The original inventors of the
terms "concept" , "model" chose nomenclature which has confused the
issue for two generations of programmers. It doesn't help things any
either when otherwise well respected authors define concepts like
"Sortable" which confusing things even more.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk