
On Mon, Oct 8, 2012 at 10:34 PM, Nathan Ridge <zeratul976@hotmail.com> wrote:
Or what mechanism should be used to allow types which fulfil axioms only partly? axiom_cast<double,TotallyOrdered> ?
I would prefer something like this - explicitly overriding axiom-checking in the few cases where this would need to be done - over losing the benefits of the compiler checking the axioms in cases where it can (which are probably also few, but they exist).
Maybe we could use the difference between bound variables and unbound to say what can be checked: template <typename Iterator, typename T> void find(Iterator first, Iterator last, T value) { axiom { x::T. x == x } [ ... ] } Would allow the compiler to check all values the function find sees. So, all values in [first, last) and value. And: template <typename Iterator, typename T> void find(Iterator first, Iterator last, T value) { axiom { /\x in T. x == x } [ ... ] } The compiler can check all values in T, so it could show that double violates this because NaNs don't compare equal to itself. Just a thought.
Regards, Nate
Regards, -- Felipe Magno de Almeida