What are “first class” objects?

前端 未结 5 661
走了就别回头了
走了就别回头了 2020-11-22 16:50

When are objects or something else said to be \"first class\" in a given programming language, and why? In what do they differ from languages where they are not?

EDI

5条回答
  •  -上瘾入骨i
    2020-11-22 17:18

    From a slide in Structure and Interpretation of Computer Programs, lecture 2A (1986), which in turns quotes Christopher Stracey:

    The rights and privileges of first-class citizens:

    • To be named by variables.
    • To be passed as arguments to procedures.
    • To be returned as values of procedures.
    • To be incorporated into data structures

提交回复
热议问题