<p>"First-class" here is roughly the informal use of the phrase meaning "having all rights and privileges", give or take. The alternative would be "second-class", as in <a href="http://en.wikipedia.org/wiki/Second-class_citizen" rel="noreferrer">the phrase "second-class citizen"</a>, but that seems to be less frequently used in this context. </p>

<p>It is, as Ohad says, a feature of a <em>language</em> which entities (functions or otherwise) it treats as "first-class", and it's also not necessarily a clear-cut distinction. Typically a first-class entity would be something tangible that can be created and used as a value at run time, without significant obstacles compared to being defined at compile time. In the case of functions, this usually means allowing higher-order and anonymous functions. A function that is not higher-order is first-order. Functions that are not anonymous don't really have a general term that I know of. But first-order functions with names can still be first-class if the language allows it.</p>

CC BY-SA 3.0
2011-08-30T19:13:26.263Z
I also use 'second-class citizen'.
gasche
CC BY-SA 3.0
2011-08-30T20:09:12.527Z
Sorry, if "first-class functions" and "higher-order functions" are the same, and "first-order" is the opposite of "higher-order", how first-order functions can be first-class?
Student
CC BY-SA 3.0
2011-08-30T20:18:50.427Z
@Tom The answer is not saying that "first-class function" are the same as "higher-order functions". The answer says that when functions are treated as first-class entities in a programming language, then that programming language usually allows higher-order (and other kinds) of functions. In other words, red is a color, green is the opposite of red, green is still a color.
Artem Kaznatcheev
CC BY-SA 3.0
2011-08-30T20:31:48.110Z
@Tom Brito: They're not the same. A language with first-class functions is one that lets them be manipulated directly. It's about what you can *do* with a function, not the function itself. In a language with first-class functions, plain first-order functions can still be passed around as arguments to higher-order functions. Note also these terms are entirely unrelated, and the fact that both use the word "first" doesn't really mean anything.
C. A. McCann
CC BY-SA 3.0
2011-08-31T13:38:05.247Z
@camccann Entirely unrelated? I think I'm really confuse now. There's no "first-order functions" in Wikipedia, is there another name for it? I would like to read more about.
Student
CC BY-SA 3.0
2011-08-31T13:42:21.767Z
@Tom Brito: The general term [first-order](http://en.wikipedia.org/wiki/First-order) has a page.
C. A. McCann
CC BY-SA 3.0
2011-08-31T14:21:14.857Z
Yes, this page will list some topics with the name "fist-order", and "First order functions" redirect to "Higher-order function", and this article don't mention the name "first-order functions", so they must be the same. And, as you say, "A function that is not higher-order is first-order". It's a bit confusing here.
Student
CC BY-SA 3.0
2011-08-31T14:26:41.280Z
Also, the "first-order" page says that `it is contrasted with "allowing some self-reference" (higher-order logic)`, so looks like the redirect is a mistake.
Student
CC BY-SA 3.0
2011-08-31T14:42:44.117Z
@Tom Brito: No, it's the same term as applied to logic, as Ohad's answer mentioned. Read the article on first-order logic if you want a better understanding of the term, and it's not too hard to see the connection to programming languages. The redirect is there because first-order functions are a trivial concept interesting only by contrast of not being higher-order.
C. A. McCann
CC BY-SA 3.0
2011-08-30T17:33:05.250Z
2011-08-30T17:33:05.250Z
C. A. McCann
<p>In formal set theory a "mapping" which isn't a function (in the formal sense) is usually called a definable mapping. The reason this might be a meaningful term to import is that these are, in some sense, the things which behave like functions in the meta theory/language while not being, themselves, objects in the theory studied (the object language).</p>

<p><s>Alternatively borrowing terms from category theory one might want to call them external functions (since they are not "elements" of the internal Hom-objects, i.e. the exponential objects).</s> (Kept this for the comments to make sense).</p>

<p>Borrowing the distinction from category between external and internal Hom-sets (that is to say collections of arrows of a category and exponential objects of a category) one might want to call "non-first class functions" <em>external</em> functions. </p>

<p>I doubt any of these are in common use, but they might at least be suggestive :)</p>

CC BY-SA 3.0
2011-08-31T14:34:29.233Z
I think the typical use of Category Theory in this case would simply regard functions as the arrows of the category, and *define* "having first-class functions" as "having exponential objects".
C. A. McCann
CC BY-SA 3.0
2011-08-31T14:44:13.773Z
I agree, what I meant was that one could import the internal/external distinction of Hom-sets (the Hom-functor and the exponential objects) to internal vs. external functions.
Tilo Wiklund
CC BY-SA 3.0
2011-08-31T14:56:31.380Z
Oh, I see. I think I misread at first. That's actually a reasonably tidy choice of terminology now that I think about it.
C. A. McCann
CC BY-SA 3.0
2011-08-31T13:56:18.030Z
2011-08-31T15:17:35.823Z
2011-08-31T15:17:35.823Z
Tilo Wiklund
<p>First, the property "having first-class functions" is a property of a <em>programming language</em>, not of particular functions in it. Either your language allows for functions to be passed around and created at will, or it doesn't.</p>

<p>Functions that accept or return other functions as arguments are called <em>higher-order</em> functions. (The terminology comes from logic.)  Functions that don't are called <em>first-order</em> functions. Perhaps this latter notion is what you wanted.</p>

CC BY-SA 3.0
2011-09-01T08:07:34.613Z
I really don't see why you, in theory, couldn't have programming languages where some functions where objects while others, for one reason or another, weren't.
Tilo Wiklund
CC BY-SA 3.0
2011-09-01T09:04:28.677Z
You can, but then the property 'has first class functions' doesn't hold for your language. For example, in Ada you can pass functions that don't require a closure around. So you have something resembling higher-order functions, but the language doesn't have first class functions (for other reasons too).
Ohad Kammar
CC BY-SA 3.0
2011-09-01T09:22:17.320Z
My point is that indeed some languages have that property. But I'm not familiar with specialised terminology to them.
Ohad Kammar
CC BY-SA 3.0
2011-08-30T17:02:46.477Z
2011-08-30T17:02:46.477Z
Ohad Kammar
<p>I mean, is there an antonym for "first-class function"?</p>

CC BY-SA 3.0
2011-08-30T20:58:16.957Z
If you wanted more than what's on wikipedia it would've been helpful to provide more context.
Huck Bennett
CC BY-SA 3.0
2011-08-31T14:01:12.457Z
@Huck Bennett If you read the [wikipedia article](http://en.wikipedia.org/wiki/First-class_function), you will only see it saying that, in imperative languages, the functions are "second-class citizens". But it's not clear if every "non-first-class function" is a "second-class function". Also, in Ohad's answer, he tells about "first-order functions", which is new for me, and there isn't an article on Wikipedia about that. So maybe the answers here are more interesting then Wikipedia. And it's a simple theoretical question, I really can't see how could I provide more context.
Student
<pl.programming-languages><terminology><functional-programming><language-design>
How can I call functions that are not "first-class functions"?
Student
# How can I call functions that are not "first-class functions"?

(Asked by: username_0 on 2011-08-30)

I mean, is there an antonym for "first-class function"?

**Tags:** pl.programming-languages, terminology, functional-programming, language-design
> **Comments:**
> **username_1**: If you wanted more than what's on wikipedia it would've been helpful to provide more context.  
> **username_0**: @Huck Bennett If you read the [wikipedia article](http://en.wikipedia.org/wiki/First-class_function), you will only see it saying that, in imperative languages, the functions are "second-class citizens". But it's not clear if every "non-first-class function" is a "second-class function". Also, in Ohad's answer, he tells about "first-order functions", which is new for me, and there isn't an article on Wikipedia about that. So maybe the answers here are more interesting then Wikipedia. And it's a simple theoretical question, I really can't see how could I provide more context.  

---

## 3 answers

### Answer by username_6 on 2011-08-30. Score: 12 | Accepted answer

First, the property "having first-class functions" is a property of a *programming language*, not of particular functions in it. Either your language allows for functions to be passed around and created at will, or it doesn't.

Functions that accept or return other functions as arguments are called *higher-order* functions. (The terminology comes from logic.) Functions that don't are called *first-order* functions. Perhaps this latter notion is what you wanted.

> **Comments:**
> **username_5**: I really don't see why you, in theory, couldn't have programming languages where some functions where objects while others, for one reason or another, weren't.  
> **username_6**: You can, but then the property 'has first class functions' doesn't hold for your language. For example, in Ada you can pass functions that don't require a closure around. So you have something resembling higher-order functions, but the language doesn't have first class functions (for other reasons too).  
> **username_6**: My point is that indeed some languages have that property. But I'm not familiar with specialised terminology to them.  

---

### Answer by username_2 on 2011-08-30. Score: 5

"First-class" here is roughly the informal use of the phrase meaning "having all rights and privileges", give or take. The alternative would be "second-class", as in [the phrase "second-class citizen"](http://en.wikipedia.org/wiki/Second-class_citizen), but that seems to be less frequently used in this context.

It is, as Ohad says, a feature of a *language* which entities (functions or otherwise) it treats as "first-class", and it's also not necessarily a clear-cut distinction. Typically a first-class entity would be something tangible that can be created and used as a value at run time, without significant obstacles compared to being defined at compile time. In the case of functions, this usually means allowing higher-order and anonymous functions. A function that is not higher-order is first-order. Functions that are not anonymous don't really have a general term that I know of. But first-order functions with names can still be first-class if the language allows it.

> **Comments:**
> **username_3**: I also use 'second-class citizen'.  
> **username_0**: Sorry, if "first-class functions" and "higher-order functions" are the same, and "first-order" is the opposite of "higher-order", how first-order functions can be first-class?  
> **username_4**: @Tom The answer is not saying that "first-class function" are the same as "higher-order functions". The answer says that when functions are treated as first-class entities in a programming language, then that programming language usually allows higher-order (and other kinds) of functions. In other words, red is a color, green is the opposite of red, green is still a color.  
> **username_2**: @Tom Brito: They're not the same. A language with first-class functions is one that lets them be manipulated directly. It's about what you can *do* with a function, not the function itself. In a language with first-class functions, plain first-order functions can still be passed around as arguments to higher-order functions. Note also these terms are entirely unrelated, and the fact that both use the word "first" doesn't really mean anything.  
> **username_0**: @camccann Entirely unrelated? I think I'm really confuse now. There's no "first-order functions" in Wikipedia, is there another name for it? I would like to read more about.  
> **username_2**: @Tom Brito: The general term [first-order](http://en.wikipedia.org/wiki/First-order) has a page.  
> **username_0**: Yes, this page will list some topics with the name "fist-order", and "First order functions" redirect to "Higher-order function", and this article don't mention the name "first-order functions", so they must be the same. And, as you say, "A function that is not higher-order is first-order". It's a bit confusing here.  
> **username_0**: Also, the "first-order" page says that `it is contrasted with "allowing some self-reference" (higher-order logic)`, so looks like the redirect is a mistake.  
> **username_2**: @Tom Brito: No, it's the same term as applied to logic, as Ohad's answer mentioned. Read the article on first-order logic if you want a better understanding of the term, and it's not too hard to see the connection to programming languages. The redirect is there because first-order functions are a trivial concept interesting only by contrast of not being higher-order.  

---

### Answer by username_5 on 2011-08-31. Score: 2

In formal set theory a "mapping" which isn't a function (in the formal sense) is usually called a definable mapping. The reason this might be a meaningful term to import is that these are, in some sense, the things which behave like functions in the meta theory/language while not being, themselves, objects in the theory studied (the object language).

~~Alternatively borrowing terms from category theory one might want to call them external functions (since they are not "elements" of the internal Hom-objects, i.e. the exponential objects).~~ (Kept this for the comments to make sense).

Borrowing the distinction from category between external and internal Hom-sets (that is to say collections of arrows of a category and exponential objects of a category) one might want to call "non-first class functions" *external* functions.

I doubt any of these are in common use, but they might at least be suggestive :)

> **Comments:**
> **username_2**: I think the typical use of Category Theory in this case would simply regard functions as the arrows of the category, and *define* "having first-class functions" as "having exponential objects".  
> **username_5**: I agree, what I meant was that one could import the internal/external distinction of Hom-sets (the Hom-functor and the exponential objects) to internal vs. external functions.  
> **username_2**: Oh, I see. I think I misread at first. That's actually a reasonably tidy choice of terminology now that I think about it.  

---

