[Haskell-cafe] Functions are first class values in C

Jules Bean jules at jellybean.co.uk
Sat Dec 22 07:09:13 EST 2007


Cristian Baboi wrote:
> Let me show you an example to prove it.

That's not C.

That's the C preprocessor, which is a textual substitution macro 
language. Macros certainly aren't first class (you can't pass a macro to 
a function, only its expansion).

C does support function pointers, which are something like first class 
functions. The main things C lacks which people associate with true 
first-class function is:

The ability to construct anonymous/local functions.

The ability to capture local variables and return a function with some 
variables bound.

The ability to write type-safe functions with polymorphic arguments.

Jules


More information about the Haskell-Cafe mailing list