In programming language design, a first-class citizen (also typeobjectentity, or value) in a given programming language 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.[1]

The simplest scalar data types, such as integer and floating-point numbers, are nearly always first-class.

In many older languages, arrays and strings are not first-class: they cannot be assigned as objects or passed as parameters to a subroutine. For example, neither Fortran IV nor C supports array assignment, and when they are passed as parameters, only the position of their first element is actually passed—their size is lost. C appears to support assignment of array pointers, but in fact these are simply pointers to the array's first element, and again do not carry the array's size.

In most languages, data types are not first-class objects, though in some object-oriented languages, classes are first-class objects and used for metaclasses.

Few languages support continuations and GOTO-labels as objects at all, let alone as first-class objects.

Concept Description Languages
first-class function closures and anonymous functions SchemeMLHaskellF#ScalaSwiftPHPPerl 6JavaScript
first-class control continuations SchemeMLF#
first-class type   CoqIdris
first-class data type   Generic Haskell. C++11
first-class polymorphism impredicative polymorphism  
first-class message dynamic messages (method calls) Smalltalk,[7] Objective-C[7]
first-class class metaclass SmalltalkObjective-CRubyPython
  proof object[8] CoqAgda

最新文章

  1. 妈妈再也不用担心我找不到spring源码了!
  2. display:box和display:inline-box的区别
  3. JavaEE基础(二十四)/多线程
  4. OSGi之Bundle
  5. Java多线程时内存模型
  6. 判断js中的数据类型
  7. HDU1180+BFS
  8. TCP建立连接的3次握手和关闭连接的4次挥手
  9. C语言之头文件,static与const关键字
  10. 在centos6.5下yum仓库的创建
  11. MongoDB获得短暂的
  12. highcharts设置Y轴范围及根据Y轴范围设置不同颜色
  13. QT第四天学习
  14. Sublime Text3 高亮显示Jade语法 (Windows 环境)
  15. 【Centos7】安装nginx
  16. 配置可以通过http协议访问的svn服务器
  17. Spring -bean的装配和注解的使用
  18. js基础语句
  19. 爬取字段 spider_text
  20. windows 下安装MySQL 服务无法启动类问题

热门文章

  1. ES6的基本语法
  2. 从EntityFramework转换EntityFrameworkCore的正确姿势(DBFirst)
  3. mac修改管理员权限命令
  4. 博客移至 GitHub
  5. SpringMVC(六)POJO类作为 @RequestMapping方法的参数
  6. ZBrush中SnakeHook蛇钩笔刷介绍
  7. java导出html页面
  8. PHP内置SOAP扩展客户端的使用例子
  9. [读书笔记] Python 数据分析 (八)画图和数据可视化
  10. 【codeforces 812B】Sagheer, the Hausmeister