Re: syntax suggestion for concepts
on Tue Mar 20 2007, "W Karas" <wkaras-AT-yahoo.com> wrote:
On Mar 19, 2:50 pm, d...@boost-consulting.com (David Abrahams) wrote:
on Thu Mar 08 2007, "W Karas" <wkaras-AT-yahoo.com> wrote:
it seems to me that the most commonly used templates in the STL
have only one type parameter. The exception is map<>, but that
is a case where no multiple dispatch is needed even though there
are two type parameters.
You're focusing on class templates, which in STL are a bit of a
distraction from its essential Generic Programming stuff: the
algorithms (and concepts). When looking at the STL through a Generic
Programming lens, containers are best viewed as examples of some of
the concepts... and not very strong concepts at that! (see item 2 ofhttp://tinyurl.com/34o9ks:http://tinyurl.com/39jpfh)
If you look at the algorithms you'll find that nearly all of them have
more than one template parameter.
You have a point, but I don't think that fully refutes my argument.
If you look at an algorithm like find, yes, it does have two
type parameters. But the only possible multiple dispatch case
is the call to operator != (RT a, T b) where RT is the return
type of the iterator's 'operator *' and T is the type of the
sought value. I would guess that, in the great majority
of situations where 'find' is used, T is the same as RT, or
an instance of T implicitly converts to RT, so there is no
true multiple dispatch.
I don't really see what that proves. T is not always the same as RT.
And then there's find_if, transform, accumulate, lower_bound, and a
whole slew of other algorithms with more complicated type
relationships.
Maybe multiple dispatch does occur frequently when using
templates. But if GP is just OO with multiple dispatch and earlier
bindings,
It isn't. Did somebody claim it was?
that doesn't justify viewing GP and OO as being in some
huge all-important cage-match dichotomy in my opinion.
Whoosh! That went right over my head; I have no clue what you're
trying to say here.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]