On 2014-07-31 19:54, Robert Ramey wrote:
Eric Niebler-4 wrote
On 07/29/2014 05:14 PM, Niall Douglas wrote:
I'm all for Concepts as in compiler enforced ones, and I'll add them to AFIO when and only when C++ gets them. But for documentation they don't help. Wow, I couldn't disagree more. I can't imagine how the standard algorithms would be specified without the use of concepts like "RandomAccessIterator", for instance. Clustering requirements into meaningful abstractions and assigning them names makes it possible to document library interfaces without an explosion of verbosity and repetition. +10 +10
Can't wait till Concepts Lite are there!
Usage of concepts is greatly:
a) misunderstood b) misunderestimated as to their value in design AND documentation
Right, last year, I heard several people basically asking "why on earth would anyone want this?" after listening to a talk about Concepts Lite. It took me a about an hour at dinner to convince some of them that it might be worth looking into the topic a bit more...
d) The word "concepts" is a big contributor to the problem - substitute "type requirements" or "type constraints" for concepts. I like "type constraints" best. c) usage of concepts is much confused with implementation of concepts. Usage of "type constraints" doesn't require any special support from C++. static_assert with type traits is usually all that is necessary. e) recent papers using examples such as "Sortable" add more bad advice and confusion.
I've included a page in the Boost Incubator to promote my views on the subject - if anyone cares.
http://rrsd.com/blincubator.com/advice_concepts/ Very nice compilation!
I am impressed by Boost Concept Check Library (the second link to it is broken in your document, btw). But I feel rather helpless when stumbling over problems (for example, your code does not compile with the admittedly ancient boost 1.46 on my machine and I have no idea what to do with the compile errors). I am therefore rather sticking with static_assert to enforce constraints with friendly error messages for the time being until Concepts Lite are available as TS or part of the standard. Cheers, Roland