Boost logo

Boost :

Subject: Re: [boost] [GSoC] [Boost.Hana] Formal review request
From: Robert Ramey (ramey_at_[hidden])
Date: 2014-08-03 23:08:58


Niall Douglas wrote
> On 3 Aug 2014 at 8:48, Robert Ramey wrote:
>
>> My real goal is to convince the C++ community that any library which
>> includes templates as part of the user interface must have explicit type
>> constraints in order to be considered for formal review. I want to see
>> type constraints be understood and appreciated by the C++ user community
>> in general rather than a small group who spend years disputing how to
>> implement the idea.
>
> I strongly disagree with this idea if by "type constraints" you mean
> "error out if it doesn't fit" which apparently you do.

Correct - that is EXACTLY what I mean. Function parameters have specific
types and if a function is invoked with parameters of other types - it's
a compile time error. The same is (or should be) true for template
parameters. That is, what constitutes an acceptable parameter shouid
be explicitly stated and checked at compile time. Otherwise there
is no way to demonstrate program correctness. This has been
the focus and intent of C++ concepts (type constraints) from the
very beginning. (around 2000)

My view on what C++ concepts are is widely held.

http://en.cppreference.com/w/cpp/concept
http://en.wikipedia.org/wiki/Concepts_(C%2B%2B)
C++ standard paragraphs 17.5.1.3

> That isn't really concepts at all in my opinion, it's just some sort of
> super
> static assert.

lol - maybe that's all it is. Using a parameter which doesn't fit the
stated type requirements creates a compile time error. Using the
term "super static assert" isn't really wrong. One could call all
compile time errors "super static assert"s if he wanted to and not
be totally wrong. But the term "C++ concept" has already been
defined and widely used. So it tough for you decide that it
means something else. Having said that, I would be pleased
if we started using the them "type constraints" instead. Had we
done that before we probably wouldn't be having this discussion.

> We are still in the very early days of concepts, language support
> isn't even in there yet - it is like trying to standardise exception
> handling before the language gained support. Once the TS is finished
> and accepted and we know exactly what will be in the language, then
> is the time to start thinking about formal review requirements. i.e.
> at least two or three years from now.

Language support of C++ concepts is a side issue and a distraction.
Note that the "concepts" them selves (E.G. Default constructible)
are in fact defined in C++11 even thought we don't have language
support to enforce them.

see http://en.cppreference.com/w/cpp/types/is_default_constructible
These can be used to enforce type requirements as well as dispatch
based in type requirements using enable if.

This discussion is about the following:

a) what are C++ concepts.
b) what role do/should they play in library design
c) what role do/should they play in library documentation
d) are current library implementations sufficient to be of use.

Robert Ramey

--
View this message in context: http://boost.2283326.n4.nabble.com/Re-GSoC-Boost-Hana-Formal-review-request-tp4665622p4666003.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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