英文:
in golang, reflect pkg, 8g error "undefined: reflect.NewValue"
问题
对于reflect包有点困惑
所有的例子都使用reflect.NewValue()来获取变量的reflect.Value,但是
- 
func NewValue在http://golang.org/pkg/reflect/中没有记录 - 
8g编译器返回“undefined: reflect.NewValue”
 
NewValue()还被支持吗?如果不支持,如何从变量中获取reflect.Value?
Typeof和NewValue函数已被重命名为TypeOf和ValueOf。
英文:
little confused with reflect pkg
all of the examples us reflect.NewValue() to get the reflect.Value of a var, but
- 
func NewValueis not documented in http://golang.org/pkg/reflect/ - 
the 8g compiler returns "undefined: reflect.NewValue"
 
is NewValue() still supported? if not, how does one get reflect.Value from a var?
<hr />
the Typeof and NewValue functions have been renamed to TypeOf and ValueOf.
答案1
得分: 0
Go reflect package 在 weekly.2011-04-13 及之后的版本中进行了重大修订。详细信息请参见 revision 843855f3c026。
英文:
The Go reflect package was substantially revised for the weekly.2011-04-13 and subsequent releases. For details, see revision 843855f3c026.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论