This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unnamed functions, functors or, more formally, function literals


On Fri, Mar 15, 2002 at 07:06:25PM -0500, Robert Dewar wrote:
> <<If they are useful or not is mainly a matter of programming style.
> Personally I like them, but then I am familiar with functional
> languages where anonymous functions are an important part of the
> language. (Program in List or ML for a while, and I think you will see
> how they can be useful.)
> >>
> 
> Well I don't know List, but I have programmed extensively in Lisp and other
> functional languages, and I don't see things the way you do at all. This is
> just a convenience of binding issue, not anything that reflects issues of
> expressive power (this is true in both functional and procedural languages).

[I meant Lisp, not List. Sorry for the typo.]

Yes, of course it is a convenience but so is a lot of other stuff in
most programming languages.  One could probably remove a large part of
most languages without reducing their expressive power.

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.





-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]