From d28ec7bcc78b2159263c975fb5c47595bc375b4f Mon Sep 17 00:00:00 2001 From: Jiaying Ren Date: Thu, 23 Jan 2014 21:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=AF=B9=E5=8F=8D=E5=B0=84?= =?UTF-8?q?=E7=9A=84=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原句中`所谓反射就是动态运行时的状态。`,去掉形容词就是说`反射就是状态`? 按照The Laws of Reflection中的解释: `Reflection in computing is the ability of a program to examine its own structure, particularly through types;` 可以看出反射是程序的一种能力。FYI. --- ebook/02.6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ebook/02.6.md b/ebook/02.6.md index 3eab691e..e5eeb859 100644 --- a/ebook/02.6.md +++ b/ebook/02.6.md @@ -354,7 +354,7 @@ Go里面真正吸引人的是它内置的逻辑语法,就像我们在学习Str } ### 反射 -Go语言实现了反射,所谓反射就是动态运行时的状态。我们一般用到的包是reflect包。如何运用reflect包,官方的这篇文章详细的讲解了reflect包的实现原理,[laws of reflection](http://golang.org/doc/articles/laws_of_reflection.html) +Go语言实现了反射,所谓反射就是能检查程序在运行时的状态。我们一般用到的包是reflect包。如何运用reflect包,官方的这篇文章详细的讲解了reflect包的实现原理,[laws of reflection](http://golang.org/doc/articles/laws_of_reflection.html) 使用reflect一般分成三步,下面简要的讲解一下:要去反射是一个类型的值(这些值都实现了空interface),首先需要把它转化成reflect对象(reflect.Type或者reflect.Value,根据不同的情况调用不同的函数)。这两种获取方式如下: