Why is reflection called reflection instead of introspection?

前端 未结 6 1860
孤独总比滥情好
孤独总比滥情好 2020-12-04 16:16

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 p

6条回答
  •  感动是毒
    2020-12-04 17:06

    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,

提交回复
热议问题