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 ...
随机推荐
- 杂文 | 金沙江创投朱啸虎谈微信小程序
我一直在想怎么去描述和朱啸虎的聊天. 最简单的开头一定是说“独角兽捕手朱啸虎”看好小程序了,这个赛道蕴含了许多无比巨大.充沛的机会,所以约到朱啸虎同学深聊这个赛道的创业.但是这样的开头太平,不好玩.事 ...
- 通过obs进行推流
我们除了通过ffmpeg进行推流外还可以使用OBS这个软件进行推流, 界面化工具,配置起来也方便 obs下载地址 obs的基本配置使用教程 这里需要注意的是在填写推流地址URL 的时候 有一个流秘钥 ...
- 跟着8张思维导图学习javascript (转)
学习的道路就是要不断的总结归纳,好记性不如烂笔头,so,下面将po出8张javascript相关的思维导图. 思维导图小tips:思维导图又叫心智图,是表达发射性思维的有效的图形思维工具 ,它简单却又 ...
- Spring Boot 20170913
SpringBoot 是做微服务的,比如只用来发邮件,只用来上载文件等等.优点是开发极其简单,约定大于俗成,缺点是不适合小型项目.通常用来分解大型项目,做成多个微服务. 参考: http://www. ...
- 粘包_Client
# from socket import *# import time# ip_port = ('127.0.0.1',8080)# back_log = 5# buffer_size = 1024# ...
- BZOJ 3786 星系探索 (splay+dfs序)
题目大意:给你一棵树,支持一下三种操作 1.获取某节点到根节点的路径上所有节点的权值和 2.更换某棵子树的父亲 3.某子树内所有节点的权值都增加一个值w 当时想到了splay维护dfs序,查完题解发现 ...
- 移动端优先的flex三栏布局
默认情况下先显示移动端,通过 @media 属性适配屏幕变化 使用flexbox相关的CSS属性 display: flex; (父元素) flex-wrap: nowrap | wrap | wra ...
- Python字典嵌套
import copy menu = { "计算机科学与技术":{ "程序编程":{ "传统语言":{ "C++":&q ...
- 【codeforces 794A】Bank Robbery
[题目链接]:http://codeforces.com/contest/794/problem/A [题意] 每个位置上可能有物品(>=1)或是没物品 你一开始在某一个位置b; 然后你最左可以 ...
- Restful技术
一.概述 Restful技术是一种架构风格(Representational State Transfer)表现层状态转化,而不是一种编程标准. 之前前后端混在一起,前端通过mapping映射找到后端 ...