为什么反射被称为反射而不是内省?

时间:2022-02-01 11:32:39

What is the origin of the term reflection? It seems more like introspection. Why isn't it called that?

反思一词的起源是什么?这似乎更像是内省。为什么不称它为什么?

Introspection: A looking inward; specifically, the act or process of self-examination.

内省:向内看;具体而言,是自我检查的行为或过程。

Reflection:

  1. the act of reflecting or the state of being reflected.
  2. 反映的行为或反映的状态。

  3. an image; representation; counterpart
  4. 一个图像;表示;对方

  5. a fixing of the thoughts on something; careful consideration
  6. 固定思想的东西;详细的思考

  7. a thought occurring in consideration or meditation.
  8. 思考发生在考虑或冥想。

6 个解决方案

#1


59  

There is an interesting answer on the french wikipedia article for Reflection (here)

关于反思的法国*文章有一个有趣的答案(这里)

Reflection can be decomposed in two parts:

反射可以分为两部分:

  • introspection: a program can examine itself.
  • 内省:程序可以自我检查。

  • intercession: a program can modify its state/meaning.
  • 代祷:程序可以修改其状态/含义。

So reflection is a 'stronger' property than introspection. That's why you say type introspection for the ability to know types at runtime (and changing them is another action: conversion/casting).

因此,反思是一种比内省更“强大”的财产。这就是为什么你说类型内省能够在运行时知道类型(并且更改它们是另一个动作:转换/转换)。

EDIT: actually I just realized the first answer was saying exactly that ^^. Time to unplug myself...

编辑:实际上我刚刚意识到第一个答案就是说^^。拔掉自己的时间......

#2


26  

Reflection comes from the idea of "self-examination, self-modification, and self-replication", reflecting on one's self for the purpose of change. In programming you use reflection to examine the structure of the program itself in the context of using it instead of just examining it. What you get back is a representation of the program that you can use to modify it, rather than the data on which it operates.

反思来自于“自我检查,自我修改和自我复制”的思想,反映了一个人的自我以达到改变的目的。在编程中,您使用反射来检查程序本身的结构,而不是仅仅检查它。您得到的是您可以用来修改它的程序的表示,而不是它运行的数据。

More information can be found at the wikipedia article..

更多信息可以在*文章中找到..

#3


4  

There is another concept called type introspection that refers to the ability to determine the type of an object at runtime.

还有另一种称为类型内省的概念,它指的是在运行时确定对象类型的能力。

edit: I realize your question was intended to be language-agnostic, but in Java, reflection is used to identify what members an object has, whereas introspection allows you to identify which JavaBeans properties an object has, which is why the introspection class is in the java.beans package. I'm not sure what the exact difference between the terms would be in other languages, though,

编辑:我意识到你的问题是与语言无关的,但在Java中,反射用于识别对象的成员,而内省允许您识别对象具有哪些JavaBeans属性,这就是内省类所在的原因。 java.beans包。我不确定这些术语在其他语言中的确切区别是什么,

#4


3  

The term reflection comes from Brian Cantwell Smith's 1982 PHD dissertation which can be found at http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-272.pdf

反思一词来自Brian Cantwell Smith的1982年博士论文,该论文可在http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-272.pdf找到。

What has come to be called reflection is often merely introspection, i.e., access to metadata. Smith's requirements for reflection included a causal connection from metadata back, and this is usually the missing component. One way to imagine reflection is access to implementation, and not merely the implementation of some new instance of a computation, but a computation's access to it's own implementation. Certainly Java's original reflection api was misnamed as it was not reflective in this sense.

被称为反射的东西通常仅仅是内省,即访问元数据。史密斯对反射的要求包括元数据的因果关系,这通常是缺失的组件。想象反射的一种方法是访问实现,而不仅仅是计算的一些新实例的实现,而是计算对它自己的实现的访问。当然,Java的原始反射api被错误命名,因为它在这个意义上没有反思。

#5


1  

In .Net I think the term Reflection is very appropriate because it is not the type itself that is examined, it is the manifest of the code, which is only a description.

在.Net中我认为反射这个词非常合适,因为它不是被检查的类型本身,它是代码的清单,它只是一个描述。

#6


1  

Reflection, in the sense of definitions 3 and 4, can be introspective. That is, introspection is reflection on one's self. I think that introspection is the better word to use for the act of code analyzing itself because the word is more specific, but I don't think reflection is entirely inappropriate.

在定义3和4的意义上,反思可以是内省的。也就是说,内省是对自己的反思。我认为内省是用于代码分析行为的更好的词,因为这个词更具体,但我不认为反思是完全不合适的。

#1


59  

There is an interesting answer on the french wikipedia article for Reflection (here)

关于反思的法国*文章有一个有趣的答案(这里)

Reflection can be decomposed in two parts:

反射可以分为两部分:

  • introspection: a program can examine itself.
  • 内省:程序可以自我检查。

  • intercession: a program can modify its state/meaning.
  • 代祷:程序可以修改其状态/含义。

So reflection is a 'stronger' property than introspection. That's why you say type introspection for the ability to know types at runtime (and changing them is another action: conversion/casting).

因此,反思是一种比内省更“强大”的财产。这就是为什么你说类型内省能够在运行时知道类型(并且更改它们是另一个动作:转换/转换)。

EDIT: actually I just realized the first answer was saying exactly that ^^. Time to unplug myself...

编辑:实际上我刚刚意识到第一个答案就是说^^。拔掉自己的时间......

#2


26  

Reflection comes from the idea of "self-examination, self-modification, and self-replication", reflecting on one's self for the purpose of change. In programming you use reflection to examine the structure of the program itself in the context of using it instead of just examining it. What you get back is a representation of the program that you can use to modify it, rather than the data on which it operates.

反思来自于“自我检查,自我修改和自我复制”的思想,反映了一个人的自我以达到改变的目的。在编程中,您使用反射来检查程序本身的结构,而不是仅仅检查它。您得到的是您可以用来修改它的程序的表示,而不是它运行的数据。

More information can be found at the wikipedia article..

更多信息可以在*文章中找到..

#3


4  

There is another concept called type introspection that refers to the ability to determine the type of an object at runtime.

还有另一种称为类型内省的概念,它指的是在运行时确定对象类型的能力。

edit: I realize your question was intended to be language-agnostic, but in Java, reflection is used to identify what members an object has, whereas introspection allows you to identify which JavaBeans properties an object has, which is why the introspection class is in the java.beans package. I'm not sure what the exact difference between the terms would be in other languages, though,

编辑:我意识到你的问题是与语言无关的,但在Java中,反射用于识别对象的成员,而内省允许您识别对象具有哪些JavaBeans属性,这就是内省类所在的原因。 java.beans包。我不确定这些术语在其他语言中的确切区别是什么,

#4


3  

The term reflection comes from Brian Cantwell Smith's 1982 PHD dissertation which can be found at http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-272.pdf

反思一词来自Brian Cantwell Smith的1982年博士论文,该论文可在http://publications.csail.mit.edu/lcs/pubs/pdf/MIT-LCS-TR-272.pdf找到。

What has come to be called reflection is often merely introspection, i.e., access to metadata. Smith's requirements for reflection included a causal connection from metadata back, and this is usually the missing component. One way to imagine reflection is access to implementation, and not merely the implementation of some new instance of a computation, but a computation's access to it's own implementation. Certainly Java's original reflection api was misnamed as it was not reflective in this sense.

被称为反射的东西通常仅仅是内省,即访问元数据。史密斯对反射的要求包括元数据的因果关系,这通常是缺失的组件。想象反射的一种方法是访问实现,而不仅仅是计算的一些新实例的实现,而是计算对它自己的实现的访问。当然,Java的原始反射api被错误命名,因为它在这个意义上没有反思。

#5


1  

In .Net I think the term Reflection is very appropriate because it is not the type itself that is examined, it is the manifest of the code, which is only a description.

在.Net中我认为反射这个词非常合适,因为它不是被检查的类型本身,它是代码的清单,它只是一个描述。

#6


1  

Reflection, in the sense of definitions 3 and 4, can be introspective. That is, introspection is reflection on one's self. I think that introspection is the better word to use for the act of code analyzing itself because the word is more specific, but I don't think reflection is entirely inappropriate.

在定义3和4的意义上,反思可以是内省的。也就是说,内省是对自己的反思。我认为内省是用于代码分析行为的更好的词,因为这个词更具体,但我不认为反思是完全不合适的。