Boost logo

Boost :

Subject: Re: [boost] [contract] toward N3351 concepts
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2012-10-03 05:13:51


> >> 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.
>

I find following the notation of EoP a sufficient rationale itself. You are
choosing the syntax that by now many people in the industry is familiar
with.

Regards,
&rzej


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