Lably
Skip to content

First-class citizen

Concept in programming language design

  • 3 min read
  • 4 chapters

Related on Lably

Through Parameter (computer programming), Function (computer programming) and Variable (high-level programming language)

History

The concept of first- and second-class objects was introduced by Christopher Strachey in the 1960s. He did not actually define the term strictly, but contrasted real numbers and procedures in ALGOL:

First and second class objects. In ALGOL, a real number may appear in an expression or be assigned to a variable, and either of them may appear as an actual parameter in a procedure call. A procedure, on the other hand, may only appear in another procedure call either as the operator (the most common case) or as one of the actual parameters. There are no other expressions involving procedures or whose results are procedures. Thus in a sense procedures in ALGOL are second class citizens—they always have to appear in person and can never be represented by a variable or expression (except in the case of a formal parameter)...

Robin Popplestone gave the following definition: All items have certain fundamental rights.

  1. All items can be the actual parameters of functions
  2. All items can be returned as results of functions
  3. All items can be the subject of assignment statements
  4. All items can be tested for equality.

During the 1990s, Raphael Finkel proposed definitions of second and third class values, but these definitions have not been widely adopted.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication