This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unnamed functions, functors or, more formally, function literals
- From: Erik Trulsson <ertr1013 at student dot uu dot se>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 16 Mar 2002 01:42:43 +0100
- Subject: Re: Unnamed functions, functors or, more formally, function literals
- References: <20020316003049.28B93F28C4@nile.gnat.com>
On Fri, Mar 15, 2002 at 07:30:49PM -0500, Robert Dewar wrote:
> <<The main convenience IMO of anonyomous functions is that one does not
> need to come up with a new name every time one needs a function that is
> only to be used once. This can also be achieved if one has nested
> functions since then one can reuse the same name if necessary but one
> can use pretty much the same arguments for and against nested functions
> as for anonymous functions.
> >>
>
> Sorry, I don't understand the last sentence, we have nested functions
> now. So what are you arguing for, you seem to say that if you have
> nested functions then it is not so important to have anonymous
> functions. If that is not what you are saying please clarify.
I am not really arguing *for* anything, I am mainly arguing *against*
the notion that anonymous functions are somehow useless.
And, yes, I am saying that many of the benefits of anonymous functions
can be obtained using nested functions. Sometimes anonymous functions
could give shorter and more readable code than using nested functions
but not always.
My position can be summed up as: I like anonymous functions and would
not object to seeing them added to GNU C (provided it can be done in a
reasonably sane manner), but I am certainly not going to lose any sleep
if they are not added.
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se