]> Cypherpunks repositories - gostls13.git/commit
reflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go
authorRuss Cox <rsc@golang.org>
Wed, 20 Apr 2011 20:24:45 +0000 (16:24 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 20 Apr 2011 20:24:45 +0000 (16:24 -0400)
commite1ee3b5db64dab637eab9eeca61ff55edee7f06f
tree020eee20a70e7e8ee2d45a54637fb53bf6fd088c
parentec735c4ec8b15a340f223c20b77b8456a1ebcab3
reflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go

This CL makes reflect require that values be assignable to the target type
in exactly the same places where that is the rule in Go.  It also adds
the Implements and AssignableTo methods so that callers can check
the types themselves so as to avoid a panic.

Before this CL, reflect required strict type identity.

This CL expands Call to accept and correctly marshal arbitrary
argument lists for variadic functions; it introduces CallSlice for use
in the case where the slice for the variadic argument is already known.

Fixes #327.
Fixes #1212.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4439058
src/pkg/reflect/all_test.go
src/pkg/reflect/set_test.go [new file with mode: 0644]
src/pkg/reflect/type.go
src/pkg/reflect/value.go