
Boost : 
Subject: Re: [boost] [contract] toward N3351 concepts
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 20121002 14:06:18
On Tue, Oct 2, 2012 at 10:49 AM, Andrew Sutton <asutton.list_at_[hidden]> wrote:
>> In any case, why is (2) better than (3)? What was the rationale for
>> such a syntax in Elements of Programming? (At the end I can adopt
>> whatever syntax but I will need to justify the choice in a "rationale"
>> section.)
>>
>> template< typename T >
>> concept EqualityComparable = ... // (1) no good because concepts
>> are not templates
>>
>> concept EqualityComparable< typename T > = ... // (2)
>>
>> concept <typename T> EqualityComparable = ... // (3)
>
> I really can't say where the concept syntax in EoP came from, but the
> notation is traditionally mathematical.
>
> If you buy into the idea that a concept is a function on template
> arguments, then I think that 2 fits with existing C++ syntax better
> than 3. After all, we don't write the type of functions ahead of their
> declarator. That is we don't declare min() as "T (T, T) min", where "T
> (T, T)" is the function type of min.
I think this is a reasonable rationale for (2) over (3) and (1).
Unless someone can point out a reason against it, I will adopt (2)
with the given rationale.
> I tend to prefer 2. It seems more consistent with existing syntax.
Thanks,
Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk