Christopher Strachey, who formulated and explained many of the basic concepts of computing more than 50 years ago, uses, as the title of a section in the written version of his well-known Oxford lectures of 1967, "First and Second Class Objects." [Strachey 2000] We use that phrase commonly to distinguish programming languages in which functions can be passed as parameters from those languages in which they cannot. Can we exploit this notion of a first-class object in some philosophical account?
We've done it before. To explicate a philosophical question in computation, we compare it to some analog in the real world, mapping attributes to each other. This reasoning mechanism is the Argument from Analogy, a powerful tool for learning. The similarity of two things is not the result; the result is whatever we can learn from the analogy, whatever further conclusions we can reach about the thing under investigation by virtue of its resemblance to another thing. Other pieces in this series on the philosophy of computer science have trod that path. [Hill 2016, Hill 2017a, Hill 2017b] It may lead to a clearer question, or perhaps a clear failure to achieve anything interesting. Even in philosophy, negative results are useful.
Here, we subject "first-class object" to that treatment. In this remark by Strachey, "...procedures in ALGOL are second class citizens—they always have to appear in person and can never be represented by a variable or expression..." [Strachey 2000, Sec. 3.5], we find the references to citizenship intriguing and even detect a nod toward personhood. How tempting to apply our favorite analytical tool.
In programming, a first-class object, such as a variable, can be passed as a parameter to or from a function, modified, and compared. A first-class object is an identifiable thing, not one of the other more ephemeral or derivative articles of computing such as a property, a value, an operator, or a type. A first-class object can stand on its own. We must not forget that all the other activities associated with variables also apply—they are created, destroyed, referenced and dereferenced, queried; they undergo quite a range of treatments.
Now what about the analogy to people? The relevant Wikipedia article is entitled "First-Class Citizen." [Wiki First Class] First-class status promises full privileges, recognition, deference, even. Sounds great! But it calls for a closer look at the factors involved. The first-class "rights" as given by Popplestone (via that Wikipedia article) follow.
- All items can be the actual parameters of functions.
- All items can be returned as results of functions.
- All items can be the subject of assignment statements.
- All items can be tested for equality.
To carry out the analogy is to apply these properties to people, of necessity forcing the fit a bit. Can people be passed to functions, and back? What would that mean?—Perhaps to be sent away to undergo treatment or to serve some purpose. Perhaps to return as a changed person, or as an agent with a mission completed. A little far-fetched. Let's look for something more persuasive. Can they be assigned values... what would that even mean? How about equality, which would expose identity—does the right to be tested for equality have anything to do with a right to equality itself? Oh, dear; weak comparisons and specious conclusions lurk everywhere. Do these sound like freedoms or oppressions? Are these rights analogous to human rights? That would be a score, but... they're not, really.
The programming elements are tokens, not types, that is, we are dealing with (via their represention by symbols) things real and particular. In a computer, a first-class object occupies memory. Yet the property of being first-class is assigned to the type, not the token. We don't see a type T such that some instantiations of T can be assigned values and some cannot (save constants, but we claim that even they are assigned values). So we see two concepts emerge, the type that enjoys first-class status, and the token that acquires its first-class status from its type. Types impose limitations on the manipulations, and on the possible values, of an object. Types are viewed as an improvement in the discipline of programming, fostering clean and safe code. But types are constraints. The elevation of objects to first-class status (for the better conceptualization and more coherent design of programs) loosens those constraints. Their accommodation of a wider range of manipulation make first-class objects, from the structured programming point of view, not a new progressive feature, but an old regressive feature.
We don't like to construe human "objects" as types. Sorting people into types is what blocks the aristocrat from marrying the servant. The obliteration of types in society could be seen as the conferral of equal rights on all. But while we like to operate in freedom, we also like to constrain manipulation. The analogy strains under this rough semantic interrogation of the terms. The normative implication of the first-class type as applied to programming elements (consistent flexibility), and the normative implication of that term as applied to human life (prejudicial ranking) are different, if not contradictory. It's interesting that the term "second-class citizen," while even less formal, enjoys wide use (even a Wikipedia article of its own [Wiki Second Class]). Restrictions imposed on second-class citizens can include voting and civil service, movement and residence, marriage, ownership. A group of them is often identified, named, and isolated. For people, types inflicted by others are not advantageous.
This analogy, of "first-class" in programming to "first-class" in people, is not working out. Are there other things in the real world that we treat in such a way that such entitlements, or their lack, are perspicuous? In the blog on software elegance [Hill 2015], I noted that we often look to architecture, with its combination of construction constraints and creative options, as an analog to software design. So let's try that. In architecture, what is a first-class object? A window, or a room, or an appliance or fixture, or a column? They hardly appear fungible, in the sense that the designer could say, "This facade is just as good as that one." And the analog to a function is more like a design paradigm, say, Art Deco, or Neoclassical, containing instructions, not just data. Is there some architectural method that invites "passing" of dynamic (or static) architectural styles? Artificial intelligence may be modularizing such design tasks, but the consequent elevation of the product to "first class" is dubious.
The particular choice of these things is what characterizes great design. A space, a line, a property only subtly different from its fellows makes some architetural design great and some mediocre. In literary fiction, what is a first-class object? A character? A subplot? A scene? A locale? A story is not an assembly of modules but an organic whole; the reader wants to think that it could only have happened that way. In creative writing, a first-class object is just a commodity, formulaic, like many modern film and television productions. We conclude that in architecture and the creative arts the exploitation of what look like first-class objects shows a lack of imagination.
We have elicited no analogy strong enough to support further conclusions about first-class objects. In fact, we have discovered reasons to disparage real-world objects that exhibit the features granted to first-class objects in programming. In this exercise of the Argument from Analogy, we founder in the philosophical weeds. There may be other ways, of course, to interrogate first-class objects in programming for philosophical answers. Meahwhile, we abandon this attempt. While philosophy embraces speculation, it also demands substance. Philosophy is not as loose as it may sometimes seem.
[Hill 2015] Hill, Robin K. 2015. What Makes a Program Elegant? October 11, 2016. [email protected]
[Hill 2016] Hill, Robin K. 2016. Fiction as Model Theory. December 30, 2016. [email protected]
[Hill 2017a] Hill, Robin K. Operating Systems as Possible Worlds. April 29, 2017. [email protected]
[Hill 2017b] Hill, Robin K. Human Acts and Computer Apps. November 28, 2017. [email protected]
[Strachey 2000] Strachey, Christopher. Fundamental Concepts in Programming Languages. Higher-Order and Symbolic Computation. Vol. 13, no. 1, 11--49. This paper forms the substance of a course of lectures given at the International Summer School in Computer Programming at Copenhagen in August, 1967.
[Wiki First Class] Wikipedia contributors. 2018. First-class citizen. Wikipedia, The Free Encyclopedia. Online. Accessed 19-July-2018.
[Wiki Second Class] Wikipedia contributors. 2018. Second-class citizen. Wikipedia, The Free Encyclopedia. Online. Accessed 28-July-2018.
Robin K. Hill is adjunct professor in both the Department of Philosophy and in the Wyoming Institute for Humanities Research, and and lecturer in the Department of Computer Science, of the University of Wyoming. She has been a member of ACM since 1978.