Article View: comp.lang.misc
Article #2632Re^4: On whether C has first-class composable functions
From: Ken Dickey
Date: Tue, 08 Jan 1991 19:55
Date: Tue, 08 Jan 1991 19:55
56 lines
2758 bytes
2758 bytes
In comp.lang.misc you (Dan Bernstein) write:
>In article <443@data.UUCP> kend@data.UUCP (Ken Dickey) writes:
[Quote from Guy Steele]
>> SCHEME also permits the treatment of functions as full flegded data
>> objects; they may be passed as arguments, returned as values, made
>> part of composite data structures, and notated as independent, unnamed
>> ("anonymous") entities. {Contrast this with most ALGOL-like
>> languages, in which a function can be written only by declaring it and
>> giving it a name; imagine being able to use an integer value only by
>> giving it a name in a declaration!).
Dan>``Full-fledged data objects,'' yes; but ``first-class'' doesn't mean
Dan>``full-fledged.''
Actually, they are synonymous in the literature. E.g.: the T Manual **
states
Procedures are "full fledged" data objects in T
while a paper on T language *** states
procedures are "first-class citizens"; they may be stored ...
[Same authors, same year].
The whole idea of being a full fledged or first-class citizen is
having the maximal rights of citizenship. In most languages, integers
are first class citizens. I don't have to name (declare) numbers
before use, I can pass them as parameters, return them as results, I
can generate new numbers in a fairly unconstrained way. Pointers are
first-class data objects in C. I can take the address of any location
I can specify, as many times as I want, etc. Functions in C are
constrained in ways that do not allow them first class status. To
quote from a previous missive:
>Your definition of unnamed functions did not magically turn them into
>function pointers. Either you are trying to return a function by value,
>which is impossible in C without a *semantic* extension; or you are
>returning a pointer to that function, in which case, as Karl said, the
>pointer is useless after the return.
Q.E.D.
-Ken Dickey
================================================================
** "The T Manual, Pre-release edition, 2nd Printing, 2 July 1982, Yale
U., by Norman Adams andJonathan Rees.
*** "T a Dialect of Lisp, or LAMBDA: The Ultimate Software Tool",
Conference Record of the 1982 ACM Symposium on Lisp and Functional
Technical Details
Message-ID:
<444@data.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!percy!data!kendReferences:
<442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> <443@data.UUCP> <13759:Jan800:19:2391@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!percy!data!kend From: kend@data.UUCP (Ken Dickey) Newsgroups: comp.lang.misc Subject: Re^4: On whether C has first-class composable functions Message-ID: <444@data.UUCP> Date: 8 Jan 91 19:55:27 GMT References: <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> <443@data.UUCP> <13759:Jan800:19:2391@kramden.acf.nyu.edu> Organization: Microcosm, Beaverton, OR Lines: 56