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 ...
随机推荐
- 从零开始学习SVG
1 什么是SVG? MDN中的定义是:SVG即可缩放矢量图形(Scalable Vector Graphics,SVG),是一种用来描述二维矢量图形的 XML 标记语言. 简单地说,SVG 面向图形, ...
- JavaScript DOM编程艺术(第2版)学习笔记2(4~6章应用实例)
本书的第4章使用第3章学到的操作DOM的方法和属性写了一个展示图片的网页,并在第5,6章对代码进行了优化. 第一版,搭建网页的静态结构,包括一级标题<h1>,无序列表清单<ul> ...
- React实现单例组件
问题背景 在工作中遇到了这样一个场景,写了个通用的弹窗组件,却在同一个页面中多次使用了该组件.当点击打开弹窗时,可想而知,一次性打开了多个弹窗,而业务需求只需要打开一个. 我个人在解决问题过程中的一些 ...
- Python学习——BeautifulSoup篇
BeautifulSoup Beautiful Soup 是一个可以从HTML或XML文件中提取数据的Python库.它能够通过你喜欢的转换器实现惯用的文档导航,查找,修改文档的方式.Beau ...
- Paper阅读总结Day1
Paper阅读总结Day1 1.Convolutional Neural Networks For Facial Expression Recognition 文章思想 简单的一篇关于表情识别的文章, ...
- javascript: 基于原型的面向对象编程
Douglas Crockford指出javascript是世界上最被误解的编程语言.由于javascript缺少常见的面向对象概念,许多程序猿认为javascript不是一个合适的语言.我在做第一个 ...
- 转载:Vim 配置入门
转载:Vim 配置入门 原文地址:http://www.ruanyifeng.com/blog/2018/09/vimrc.html 作者: 阮一峰 Vim 是最重要的编辑器之一,主要有下面几个优点. ...
- Anaconda3 安装报错 bunzip2: command not found
报错信息 Anaconda3-5.3.1-Linux-x86_64.sh: line 353: bunzip2: command not found tar: This does not look l ...
- 树莓派搭建 Google TV
出处:http://my.oschina.net/funnky/blog/142067 树莓派搭建 Google TV 目录:[ - ] Google TV是啥玩意 ? 搭建我们自己的Google T ...
- HDU 4458 Shoot the Airplane( 判断点在多边形内外 )
链接:传送门 题意:这个游戏是一个2D打飞机游戏,飞机以速度 v 水平飞行,它是一个简单的多边形,玩家从( 0 , 0 )向上射击,子弹有一个出速度 b ,子弹可以看作一个点,打中飞机边缘是无法击落飞 ...