术语“第一类对象”的来源 [英] Origin of the term "first-class object"

查看:43
本文介绍了术语“第一类对象”的来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有谁知道这个词的来源?


一流的对象表示可以在

函数调用中作为参数传递的东西,但我没有看到与对象类的连接

或first-class机票。我只是觉得这个名字有点奇怪。此外,如果有一流的物品,

二等物体或经济/旅游类物品会是什么? :)


只是想知道,


Hung Jung

解决方案

< blockquote> Hung Jung Lu写道:

有人知道这个词的来源吗?

一流的对象表示可以在
函数调用中作为参数传递的东西,但我看不到与对象类
或一流机票的连接。




它与前者没有任何联系(因为长期

早于面向对象,据我所知)。它确实与后者有一个

的连接,因为第一类的东西都是

所欠的特权和属性作为一个完整的东西。

所以一流的对象对你自己来说,它是一个完整的实体,并且可以传递给函数并从它们返回,如你所说的那样。


想想一流的对象 ;作为重要的事情也许它会让

更有意义。


-

Erik Max Francis&& ma*@alcyone.com && http://www.alcyone.com/max/

__美国加利福尼亚州圣何塞市&& 37 20 N 121 53 W&& & tSftDotIotE

/ \

\ __ /摆脱诱惑的唯一方法就是屈服于它。

- - Oscar Wilde


2003年11月17日13:35:36 -0800,Hung Jung Lu写道:

" First-class object"表示可以在
函数调用中作为参数传递的东西,但我没有看到与对象类
或一流机票的连接。


该术语类似于一等公民。这意味着没有其他类型的对象有权比这个对象做更多的事情,即它具有最高级别的对象状态 - 一流的。
>
此外,如果有一流的物品,二等物品或经济/旅游类物品会是什么? :)




功能较少的对象。例如。在许多支持OO的语言中,

内置类型不是一流的对象;你(不同地)不能继承他们,将他们作为参数传递,访问他们的方法等等。


使用这个术语意味着,通过社交比喻说,低于一等级的物品的存在是不可取的,应该通过将所有物体的状态提升到理想状态来纠正这个问题:

所有都是一流的。


这就是为什么Python会员为Python中的所有东西都是一个对象而感到自豪的原因。


-

\如果你被邀请参加你的第一次狂欢,不要只是出现|

` \裸体。这是一个常见的错误。你必须让裸露|

_o__)'''发生'。'' - Jack Handey |
Ben Finney< http://bignose.squidly.org/>




Hung Jung Lu <胡******** @ yahoo.com>在消息中写道

news:8e ************************** @ posting.google.c om ...



有谁知道这个词的来源?

一流的对象表示可以在
函数调用中作为参数传递的东西,但我没有看到与对象类
或一流机票的连接。我只觉得名字有点奇怪。此外,如果有一流的物品,
二等物体或经济/旅游类物体会是什么? :)

只是想知道,


我不确定是谁开始使用它,但对我来说这意味着

对象的使用没有限制。任何其他对象都与

相同。我也不确定什么能够传递

它在函数调用中与它有关;我习惯于以很多其他方式使用它们。


例如,在Python中,类和函数都是

对象(Python中没有二等公民...)

这意味着我可以在运行时将一个类对象重新绑定到另一个

模块时间,并以新的名称访问它。

我可以抛弃函数而放弃,甚至

为它们添加一些元数据方案的属性,对于

例子。


在Java中,类和方法都不是第一类

对象,即使你可以得到一个类 ;对象

如果你礼貌地问,它只是一个特殊的构造

的反射机制。


在C ++中,不是一个对象,不是头等舱。


John Roth


洪荣



Hi,

Does anybody know where this term comes from?

"First-class object" means "something passable as an argument in a
function call", but I fail to see the connection with "object class"
or with "first-class airplane ticket". I just find the name a bit
strange. Also, if there are first-class objects, what would the
second-class objects or economy/tourist class objects be? :)

Just wondering,

Hung Jung

解决方案

Hung Jung Lu wrote:

Does anybody know where this term comes from?

"First-class object" means "something passable as an argument in a
function call", but I fail to see the connection with "object class"
or with "first-class airplane ticket".



It doesn''t have any connection with the former (since the term long
predates object orientation, so far as I know). It does have a
connection to the latter, in that something going first class has all
the privileges and properties owed to it as a complete and total thing.
So a "first-class object" is a complete entity unto itself, and can be
passed to functions and returned from them, as you suggest.

Think of "first-class object" as "important thing" and maybe it''ll make
slightly more sense.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \
\__/ The only way to get rid of a temptation is to yield to it.
-- Oscar Wilde


On 17 Nov 2003 13:35:36 -0800, Hung Jung Lu wrote:

"First-class object" means "something passable as an argument in a
function call", but I fail to see the connection with "object class"
or with "first-class airplane ticket".
The term is analogous to "first-class citizen". It implies that no
other kind of object has privilege to do more than this object, i.e. it
has the most elevated object status -- first-class.
Also, if there are first-class objects, what would the second-class
objects or economy/tourist class objects be? :)



Objects with fewer capabilities. E.g. in many OO-capable languages,
built-in types are not first-class objects; you (variously) can''t
inherit from them, pass them as arguments, access their methods, etc.

Using this term implies, by social analogy, that the existence of
objects which are lower than first-class is undesirable and should be
rectified by elevating the status of all objects toward the ideal state:
where all are first-class.

This is why Pythonistas are proud that everything in Python is a
first-class object.

--
\ "If you get invited to your first orgy, don''t just show up |
`\ nude. That''s a common mistake. You have to let nudity |
_o__) ''happen.''" -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>



"Hung Jung Lu" <hu********@yahoo.com> wrote in message
news:8e**************************@posting.google.c om...

Hi,

Does anybody know where this term comes from?

"First-class object" means "something passable as an argument in a
function call", but I fail to see the connection with "object class"
or with "first-class airplane ticket". I just find the name a bit
strange. Also, if there are first-class objects, what would the
second-class objects or economy/tourist class objects be? :)

Just wondering,
I''m not sure who started to use it, but to me it means that
there are no restrictions on the object''s use. It''s the same as
any other object. I''m also not sure what being able to pass
it in a function call has to do with it; I''m used to being
able to use them in a lot of other ways.

For example, in Python both classes and functions are
objects (there are no second class citizens in Python...)
This means that I can rebind a class object into another
module at run time, and access it under its new name.
I can thow functions around with wild abandon, and even
add attributes to them for some meta-data scheme, for
example.

In Java, neither classes nor methods are first class
objects, even though you can get a "class" object
if you ask politely, it''s simply a special construct
for the reflection mechanism.

In C++, neither is an object, first class or not.

John Roth


Hung Jung



这篇关于术语“第一类对象”的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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