什么是“头等舱"?类型? [英] What is a "First Class" type?

查看:30
本文介绍了什么是“头等舱"?类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类型 T 是第一类"类型意味着什么?

What does it mean for a type T to be a "First Class" type?

推荐答案

通常表示 T 的实例可以

Usually it means instances of T can be

  • 从函数返回
  • 传入函数
  • 在运行时构建

例如,C 中的函数不是第一类类型,因为它们不能在运行时构造,但它们在 JavaScript 中.

Eg functions in C are not first class types as they cannot be constructed at runtime, but they are in JavaScript.

在某些特殊情况下,例如定理证明,这意味着类型本身是第一类对象.更多的现代文学使用具体化类型"来表示这一点,以避免这种歧义.

In some specialised circumstances, for example theorem proving, it means that types themselves are first class objects. More modern literature uses 'reified types' instead to denote this to avoid such ambiguity.

这篇关于什么是“头等舱"?类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆