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
On Friday 15 March 2002 15:30, Paul Koning wrote:
> >>>>> "Paul" == Paul V Andreev <sd70030@lanet.lv> writes:
>
> Paul> Names are only needed for shared functions! Unnamed function
> Paul> could became an idiom denoting "a helper function used only
> Paul> once".
>
> Names also make code more readable.
>
> Unnamed functions exist in one language I know of (Lisp). Admittedly
> I don't have much experience in that language, but from modest
> exposure to Elisp I have the impression that they are very rarely
> used.
It's a fundamental feature in functional languages like lisp, ml or haskell.
You should try going on your own crashcourse in haskell or ml, I personally
find these hugely more attractive than lisp. It's a very educating experience
and will help your coding in imperative languages which the "normal" ones all
are. And when you feel you're done with functional programming, then you
obviously have to try out prolog :-)
> A rarely used feature in an esoteric language doesn't sound to me like
> something crying out to be added to C...
Actually functional programming has some huge advantages in solving some
problems (compilers are supposedly one of them). The fact that almost
everyone in the industry tends to use imperative programming is IMHO more due
to the fact that no really good compilers exist for them.
Bo.
--
Bo Thorsen | Praestevejen 4
Free software developer | 5290 Marslev
SuSE Labs | Denmark