Boost logo

Boost :

Subject: Re: [boost] [guidelines] why template errors suck
From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2010-09-27 20:43:48


On Mon, 27 Sep 2010 18:35:49 -0400
David Abrahams <dave_at_[hidden]> wrote:

> At Mon, 27 Sep 2010 18:09:16 -0400,
> Eric Niebler wrote:
> >
> > On 9/27/2010 5:06 PM, David Abrahams wrote:

[snip..]

> >
> > <shrug> I leave this conversation as I leave every conversation
> > about concepts: just as confused as when I started. I write
> > template libraries and care about error messages. Concepts were
> > billed as a way to improve error messages from template libraries.
>
> That is one benefit available to a wide range of template libraries.
> Certainly, generic libraries accrue that benefit. I don't know
> whether Proto or Spirit could.
>
> > And yet nobody can tell me how to actually use concepts to implement
> > my libraries and improve error messages.
>
> I know you know the generic programming process, since we taught a
> course on it together. You have to start at the beginning and
> discover the concepts by looking at concrete algorithms, lifting out
> common requirements, and clustering those into concepts. If that
> doesn't work in your problem domain, concepts might not be an
> appropriate mechanism for what you want to. But I wouldn't draw any
> conclusions about what's possible without first trying it.
>

My experiences with concepts, and reading of proposals, I always had a
reservation with the way concepts were being sold to the masses.
Publicly many were touting concepts as means to improve error messages
- they do a good job of that certainly; but that is not their ultimate
purpose.

A good few on this list, Eric and Dave included know that the
utility had with concepts is principally to enforce stronger checking on
code, and its requirements; and along the way you get better
type-checking, and improvement in error messages. I consider it
unfortunate that concepts weren't spelled out in just this fashion; and
hunch everyone jumped on the "it will improve error messages"
band-wagon, because many knew the majority of developers wouldn't use
it, it only served utility for generic programming; but something had
to be said to the rest, to sell the idea of more than doubling the size
of the language specification.

On the subject, I'm probably one of the few who values the template
instantiation stack thrown back in the face of template errors -
especially when I'm dealing with code that isn't mine; for it teaches
you a bit more about the implementation of the library you happen to be
using (where you may otherwise not look), and proves a means of
learning - I count that as fun, (others find it a pain) - I lamented for
a time that concepts would take that away.

Cheers,

-- 
Manfred

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