First-class citizen
In programming language design, a first-class citizen (also type, object, entity, 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 | Scheme, ML, Haskell, F#, Scala, Swift, PHP, Perl 6, JavaScript |
| first-class control | continuations | Scheme, ML, F# |
| first-class type | Coq, Idris | |
| 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 | Smalltalk, Objective-C, Ruby, Python |
| proof object[8] | Coq, Agda |
First-class citizen的更多相关文章
- WordPress Citizen Space插件跨站请求伪造漏洞
漏洞名称: WordPress Citizen Space插件跨站请求伪造漏洞 CNNVD编号: CNNVD-201307-463 发布时间: 2013-07-23 更新时间: 2013-07-23 ...
- 什么是First-class citizen?
[什么是First-class citizen?] In programming language design, a first-class citizen (also type, object, ...
- 【NLP】Python NLTK获取文本语料和词汇资源
Python NLTK 获取文本语料和词汇资源 作者:白宁超 2016年11月7日13:15:24 摘要:NLTK是由宾夕法尼亚大学计算机和信息科学使用python语言实现的一种自然语言工具包,其收集 ...
- 用Kotlin语言重新编写Plaid APP:经验教训(II)
原文标题:Converting Plaid to Kotlin: Lessons learned (Part 2) 原文链接:http://antonioleiva.com/plaid-kotlin- ...
- 【Codeforces163E】e-Government AC自动机fail树 + DFS序 + 树状数组
E. e-Government time limit per test:1 second memory limit per test:256 megabytes input:standard inpu ...
- windows安装rabbitmq
官网下载windows安装版本:http://www.rabbitmq.com/install-windows.html ,安装文件rabbitmq-server-3.6.5.exe 前提:安装erl ...
- 树莓派pppoe
连接的网络是移动(铁通)的宽带,不同的宽带的dns需要修改. 1.首先安装pppoe包 apt-get install pppoe 2.然后,复制conf文件/etc/ppp/pppoe.conf: ...
- Lesson 1 A private conversation
Text Last week I went to the theatre. I had a very good seat. The play was very intersting. I did no ...
- Functional Programming without Lambda - Part 1 Functional Composition
Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had lon ...
随机推荐
- autocomplete for password
<input id="userPassword" type="password" autocomplete="current-password& ...
- Linux学习日记——源码编译Apache
[本文为笔者在学习Linux 下的软件安装时,尝试使用源码安装Apache 的过程,事后进行一个小小的总结,发现错误望指正.] 一.典型的源码编译安装软件的过程包括以下3步: 1) 运行 config ...
- .csv文件内容分隔符
CSV文件默认以英文逗号做为列分隔符,换行符作为行分隔符. 如果不提供网页形式只用命令行或二进制程序输出数据到CSV,只需要将数据段按,分割,行按\n分割,写入到一个.csv文件即可. 但有时字段 ...
- QA小课堂:一个网站或者APP开发要多少钱
经常遇到朋友问我:“开发一个京东商城需要多少钱?开发一个滴滴打车需要多少钱?”类似这样的需求,就连我这样一名伪开发者都不愿意去骗客户或者朋友,因为这种问题是很难回答出来的.为什么这么说呢?要知道类似京 ...
- iOS原生数据存储策略
一 @interface NSCache : NSObject Description A mutable collection you use to temporarily store transi ...
- Java语言特点与学习
Java语言是一款面向对象的一款高级语言是由Sun Microsystems公司(现已被oracle公司收购).由James Gosling和同事们共同研发,并在1995年正式推出,据oracle官方 ...
- 设置mySql的编码方式为utf-8
检查命令: mysql> show variables like '%char%'; 期望结果: 使用mysql命令设置: 如果仍有编码不是utf8的,请检查配置文件,也可使用mysql命令设置 ...
- 浅谈自底向上的Shell脚本编程及效率优化
作者:沐星晨 出处:http://blog.csdn.net/sosodream/article/details/6276758 浅谈自底向上的Shell脚本编程及效率优化 小论文,大家多批评指导:) ...
- 中国剩余定理(excrt) 模板
excrt板子题 #include <cmath> #include <cstdio> #include <cstring> #include <algori ...
- 实战:vue项目中导入swiper插件
版本选择 swiper是个常用的插件,现在已经迭代到了第四代:swiper4.常用的版本是swiper3和swiper4,我选择的是swiper3. 安装 安装swiper3的最新版本3.4.2: n ...