Language - First class-citizen

Card Puncher Data Processing

About

A first-class citizen is an entity which supports all the operations generally available to other entities. These operations typically include:

  • being passed as an argument,
  • returned from a function,
  • modified,
  • and assigned to a variable.

The simplest scalar (primitive) data types (such as string, numbers) are nearly always first-class.

In many older languages, arrays and strings are not first-class because they cannot be assigned as objects or passed as parameters to a subroutine.

When functions are treated as first-class objects, they are called first class function or closure

History

The concept of first- and second- class objects was introduced by Christopher Strachey.

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)…





Discover More
Event Conceptual Model
Event (Timed Measure|Action)

An event is a timed observed physical reality described by: space (location) participant. The observations describing the event are defined by the nature or physics of the observable, the observation...
Model Funny
Function - First Class Function (Closure|Function Literal)

A programming language is said to support first-class functions if it treats functions as first-class objects. The language supports: constructing new functions during the execution of a program,...



Share this page:
Follow us:
Task Runner