Boost logo

Boost :

Subject: Re: [boost] [Concepts] Definition. Was [GSoC] [Boost.Hana] Formal review request
From: Robert Ramey (ramey_at_[hidden])
Date: 2014-08-05 11:42:57


Please don't forget, that not all requirements can be checked at compile
time. For example: TotallyOrdered. Just by checking, that an expression
(a<b) is valid and yields something boolable, you can't distinguish between
TotallyOrdered, PartiallyOrdered, or maybe neuter.

&lt;/quote>

This is not true.

requirements are on types - not on instantiations of types. If it can't be
checked at compile time - it's not a type requirement - it's something else
(perhaps a pre-condition).

TotallyOrdered doesn't refer to some container that may or may not be
sorted.
It refers to the existent of a comparison function for the type which
fulfills
a number of requirements. To see this look at
https://www.sgi.com/tech/stl/StrictWeakOrdering.html

Here we can specify type requirements on functions which provide
for a strict weak ordering. These can all be verified at compile time
based on the properties of the types. Note that not all can be
verified by the compiler as some depend upon the semantic definition
of the function. But one doesn't have to know that runtime data to
verify that the function meets the conditions for a strict weak ordering.
To summarize - all type requirements can be verified when the code
is written - but not all type requirements can be verified automatically
by the compiler.

So verification of by the compiler isn't perfectly exhaustive - but it's
a heck of a lot better than what we usually do - which is nothing.

Robert Ramey

--
View this message in context: http://boost.2283326.n4.nabble.com/Concepts-Definition-Was-GSoC-Boost-Hana-Formal-review-request-tp4666011p4666079.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