Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.misc Subject: Re: class-sic. [Re: On whether C has ...] Message-ID: <4057@skye.ed.ac.uk> Date: 31 Jan 91 20:19:28 GMT References: <20058@yunexus.YorkU.CA> <27942:Jan902:20:0791@kramden.acf.nyu.edu> <27770.278aef90@kuhub.cc.ukans.edu> <22345:Jan1021:30:4591@kramden.acf.nyu.edu> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 43 In article <22345:Jan1021:30:4591@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >In computer science it's all different. I didn't realize a week ago that >``first-class'' might be meant to imply status compared to other types, >so that first-class objects get all the privileges that any other object >can get. I had seen the standard definition of ``first-class'' in terms >of argument passing and variables, and as a mathematician I assumed that >people wouldn't corrupt a standard definition to suit their purposes. But it _isn't_ the standard definition. That it is given in lots of documents doesn't make it right. The earliest discussions of first-class that I have found (well before Scheme) are basically making the point that there shouldn't be arbitrary restrictions on some objects and not others. The "bill of rights" idea has been used since at least 1968. And the presence of seemingly odd, perhaps language-specific, rights goes back just as far. In "The Design Philosophy of Pop-2", for example, one of the rights is that all objects can be compared for equality. The right to be anonymous came from reflection on the differing treatment of different kinds of objects. In most languages, numbers, strings, and structure instances (objects of some struct type) don't have names. If some other kinds of objects, such as funtions or arrays, do need names, then it makes sense to say they are in a sense 2nd-class citizens. To pick an example other than C, we can try Basic. In many versions of Basic, arrays must be established by a DIM statement, which gives them names. The total number of arrays is therefore fixed by the program source text and new arrays cannot be created at dynamically. And yet in some of these dialects, arrays can be passed (by ref) to procedures and returned by procedures. Assignment to corresponding elements is also possible as in: MAT A = B I think it is fair to say that these arrays are not 1st-class, especially compared to how some of these same Basics treat strings. But suppose we add the ability to assign whole arrays to variables (rather than element-by-element from one array to another). Would they then be 1st-class? Well, they aren't treated as well as strings. There's still now way to produce a completely new array (ie, to allocate one), and it's such differential treatment that talk of 1st and 2nd class is meant to express.