[Effective-cpp] Item 1: Uses and Abuses of vector

Adrian Fagg adrianf at evaluategroup.com
Wed Oct 27 04:24:08 EDT 2004


> -----Original Message-----
> From: effective-cpp-bounces at accu.org
> [mailto:effective-cpp-bounces at accu.org]On Behalf Of Terje Slettebø
> Sent: 26 October 2004 15:54

> > I agree, Lambda is a marvellous use of templates but I'd
> far rather the
> > language supported it directly.
>
> How would you like this language support to look like? I.e.
> how would you write
> my for_each() example, with language support for lambda functions?

Herb's later offering would be a good starting point. I'm sure we all know
what we'd want of it, i.e. support for anonymous blocks of code with easily
supplied variable names.

> > I know I'm in a minority here but I don't agree with the
> consensus that all
> > future enhancements should be in the standard libraries and
> not direct
> > support for e.g. nested functions etc.
>
> I didn't know there was consensus about this (and I'd think
> the core and
> evolution working groups would be rather surprised by it, as
> well, since they
> work on core language changes for C++0x. :) ), and in any
> case, I'm in violent
> agreement with you. :)

I recall BS making what seemed to me an intentionally pre-emptive
pronouncement to the effect that only subtle fixes and tweaks should be done
to the core language, around the time the current standard became official.
Sorry, I can't find a reference but perhaps someone else here knows?
I thought this a great shame at the time and given the lack of any outcry,
took it that the standards committee and other opinion formers were broadly
in agreement with BS.

> > Nor am I convinced that there's much point in expecting
> everyday programming
> > to be using frankly unreadable templated functors with
> binding etc. If it's
> > so good, lets have language support.
>
> My (admittably) simple example didn't use any binders, at
> all. Sure, for more
> complex expressions, you may need them for Boost.Lambda, but
> I think the
> argument against the argument that if something can be done
> in the library, it
> should be done in the library is a strawman, because I don't
> think anyone
> claims this. If it can be done _well_ in the library,
> perhaps, and you may
> agree? (In other words, would you prefer std::complex to be a
> built-in type, or
> a library-provided one, for example?)

No, of course not.

Others have mentioned closures as one of the central potential enhancements.
Please don't imagine that I'm in any way against either the standard library
or the more advanced/specialised libraries that have been created over the
last few years.
I also love the elegance of the functor approach in terms of what you get,
but not in terms of what it looks like in C++.

Regards,

Adrian

Work: mailto:adrianf at evaluategroup.com
Home: mailto:adrian.fagg at ntlworld.com

Pretty pictures: http://homepage.ntlworld.com/rbyadf/




More information about the Effective-cpp mailing list