关于first-class的问题

       去年在实习的时候,看电子版的《OReilly.Java.Enterprise.in.a.Nutshell.3rd.Edition.Nov.2005》时,对于其中讲hibernate的类映射(Class Mappings)问题的时候,提及的一个概念,first-class,迷惑不解。科班的教育根本没有向我提及这个词在计算机科学里的意义,纯粹的字面解释让人在上下文的语境中真的有点摸不清什么意思。

       So far, we've been working with what Hibernate calls "first-class" objects.

       其实这篇日志早已在去年8月16日写下,不过是在其他地方,现在觉得有必要转过来。

       下面的这个解释是别人查wikipedia然后留在blog上的,借用下来,看了之后应该再不晕了吧。

       First-class object 


       In computing, a first-class object (also -value, -entity, -citizen), in the context of a particular programming language, is an entity which can be used in programs without restriction (when compared to other kinds of objects in the same language). Depending on the language, this can imply

       being expressible as an anonymous literal value 
       being storable in variables 
       being storable in data structures 
       having an intrinsic identity (independent of any given name)
       being comparable for equality with other entities
       being passable as a parameter to a procedure/function 
       being returnable as the result of a procedure/function 
       being constructable at runtime
 


       For example, in C, it is not possible to create new functions at runtime, whereas other kinds of object can be created at runtime. So functions in C are not first-class objects; sometimes they are called second-class objects because they can still be manipulated in most of the above fashions (via function pointers). Similarly, strings are not first class objects in FORTRAN 66 as it is not possible to assign them to variables, whereas numbers can be so assigned.

———————————————————————————————— 

       First-class function 


       In computer science, a programming language is said to support first-class functions if it treats functions as first-class objects. Specifically, this means that functions can be created during the execution of a program, stored in data structures, passed as arguments to other functions, and returned as the values of other functions.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值