【发布时间】:2015-05-01 00:05:25
【问题描述】:
在 gob 使用示例http://golang.org/src/encoding/gob/example_interface_test.go 中,他们提供了以下论点:
Pass pointer to interface so Encode sees (and hence sends) a value of interface type. If we passed p directly it would see the concrete type instead. See the blog post, "The Laws of Reflection" for background.
我已经阅读了两遍《反思法则》,以及一篇相关的 Russ Cox 文章。但是我在那里找不到指针到接口和接口之间的区别。
那么为什么通过指针它看到一个接口类型的值,而没有指针它看到(令我惊讶的是)具体类型?
【问题讨论】:
标签: go