What is a first class programming construct?

前端 未结 6 894
误落风尘
误落风尘 2020-12-24 01:59

When trying to do something fairly advanced in C# (like some sort of hack), the concept of \"first class\" is raised.

For example, a method is a first class programm

6条回答
  •  孤独总比滥情好
    2020-12-24 02:43

    The notion of "first-class citizen" or "first-class element" in a programming language was introduced by British computer scientist Christopher Strachey in the 1960s in the context of first-class functions. The most famous formulation of this principle is probably in Structure and Interpretation of Computer Programs (just before Exercise 1.40) by Gerald Jay Sussman and Harry Abelson:

    • They may be named by variables.
    • They may be passed as arguments to procedures.
    • They may be returned as the results of procedures.
    • They may be included in data structures.

    Basically, it means that you can do with this programming language element everything that you can do with all other elements in the programming language.

提交回复
热议问题