Boost logo

Boost :

Subject: Re: [boost] [guidelines] why template errors suck
From: Eric Niebler (eric_at_[hidden])
Date: 2010-09-24 20:41:01


On 9/24/2010 8:22 PM, Robert Ramey wrote:
> Eric Niebler wrote:
>> This is borderline self-promotion and I fretted posting this. But we a
>> community of advanced C++ library developers and I'd really like
>> feedback about these issues. And they really do involve Boost library
>> development. If we could reach agreement about these techniques, we
>> might want to integrate them into Boost's coding guidelines.
>>
>> http://www.reddit.com/r/programming/comments/diddg/expressive_c_why_template_errors_suck_and_what/
>>
>> Comments?
>
> would all this boil down to the following guidlines.
>
> a) All template libraries should use boost::concepts ?

Certainly Concept_check or something like it has a big role to play in
this. But I wouldn't know how to use Concept_check to verify that an
expression template matches a grammar, for instance. It's not the whole
story. Though perhaps I don't know enough about the concept_check
library to see how it can apply to proto expressions and grammars.
Suggestions?

Also, I would prefer C++0x static_assert to the concept_check macros
because the error messages can be much nicer. I think the answer is that
the concept_check library badly needs a C++0x makeover.

> b) All template libraries should try to factor implemenations so that
> compile errors are not propagated?

Yes. And: detailed comments should be left near any static assertions or
concept checks, since that's where the unlucky few will end up.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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