Re: OT: functional languages (was: Politics of Java)
On Sat, Dec 14, 2002 at 06:32:43PM -0500, David Teague wrote:
> On Fri, 13 Dec 2002, Deryk Barker wrote:
> > After all, you *can* do FP in C or Pascal - it's just a lot more work.
> Pascal and C do not have functions as first class citizens, but Pascal
> closer than C. In Pascal, but not C, you can pass a function as a function
> parameter, but you can't return a function from a function in either
> language. Consquently you cannot do any of the nice self extensions that
> having functions as first class citizens provides.
You can pass function pointers around in C happily enough. I appreciate
it's less theoretically elegant than having functions as first-class
citizens, and that it doesn't allow as much compile-time checking, but
does it really limit you?
> C and Pascal do not have continuations. I've not done anything with
> continuations yet, so I cannot talk about that beyond noting the fact.
You can do coroutines in C, although it's a nasty hack. Then again, any
implementation of coroutines is going to involve some fairly complicated
code; it's just that here you can see it. So take this as you will. :)
Colin Watson [firstname.lastname@example.org]