|
Boost : |
Subject: Re: [boost] [guidelines] why template errors suck
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-09-27 12:38:30
David Abrahams wrote:
> At Mon, 27 Sep 2010 11:40:31 +0800,
> Dean Michael Berris wrote:
>>
>> The way concepts are done now is to define the syntactic requirements
>> (not so much the semantics)
>
> I think I know what you mean, but I wouldn't say it that way.
> Notwithstanding the fact that the compiler can never verify semantic
> conformance to a concept, the semantics are a required part of any
> concept definition. If your concept omits semantics, it's broken.
Hmmm - my dabbling in concepts led me to the opposite conclusion.
That is, an attempt to capture semantics in concepts is doomed
to fail. It's the implementation which defines the semantics while
the concepts only can check the syntax. The idea that concepts
could somehow help in clarifying the semantics made it much
harder to grasp what the concept (of concepts) was about. Of
course the nomenclature doesn't help any either.
I realise that Eric's concern is about Proto. But I'm more interested in
considering a more limited question.
a) Should all libraries include compile time code to verify
that template parameters meet their stated syntactic requirements?
b) Is there code (i.e. Boost concept check or other) which can
actually do this in a practical way. Practical would mean has
a decent syntax of its own, doesn't take toooooo long to compile
etc.
c) Is there a straight forward idiom/pattern such as that suggested by
Eric for truncating compile time error listings?
d) Should new libraries be expected to implement this? should
old libraries be expected to add it in?
It seems that the discussion of Proto goes way beyond the issue
raised checking template parameters. If there is a system which
fullfills the requirements above, it would be useful even if it doesn't
handle the issues presented by proto.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk