
------- Forwarded message -------
From: "Cristian Baboi"
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.
Well, the preprocessor is part of the language in a way. These two come together.
Macros certainly aren't first class (you can't pass a macro to a function, only its expansion).
In Haskell I cannot pass a function 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.
If you look at the example you will see I've done that.
The ability to capture local variables and return a function with some variables bound.
If I can construct "anonymous" functions and "constants", I can construct functions with some variables bound.
The ability to write type-safe functions with polymorphic arguments.
I didn't know this must be a property of first-class functions. C is staticaly typed, so type errors will be detected. Haskell is just C with some syntactic sugar :-)