[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: functional languages (was: Politics of Java)



On Sun, 15 Dec 2002, Craig Dickson wrote:

> Date: Sun, 15 Dec 2002 09:16:43 -0800
> From: Craig Dickson <crdic@pacbell.net>
> To: Debian Users <debian-user@lists.debian.org>
> Subject: Re: OT: functional languages (was: Politics of Java)
>
> Colin Watson wrote:
>
> > 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?
>
> Yes, it does. C function pointers are just pointers to code; there is no
> associated environment, no lexical scoping of variables, etc. This is
> critical to the concept of a functional language (and the lack of
> lexical scoping is one of the major reasons why traditional Lisp cannot
> be considered an FPL).

Craig and others

Having "undesirable" featuers such as maintaining state or having dynamic
scoping, does not make a language not be functional. The paradigm in
scheme and common lisp (both of which have static scoping by the way) is
functional. A program in these languages is a collection of nested
functions, so these are functional languages. When scheme added lexical
scoping, it made that functional language much more useful. When Common
Lisp added lexical (static) scoping, Common Lisp was much improved.

Unfortunately they added some ketchup to the caviar by introducing the
state maintaining looping, sequencing, assignment, and binding of
functions and data to identifiers to Scheme. I believe these and I/O are
the only imperative features of scheme, and (less certain) believe they
are the only imperative features of lisp.

David Teague



Reply to: