Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
reflect: clarify that behaviour of Value returned from Value.Method is different from method value #6581
What steps will reproduce the problem? http://play.golang.org/p/xPA5hW4GQe What is the expected output? Some users might expect the receiver of a function value returned by Value.Method to be evaluated the same way it is for a method value once they've removed in from reflection land by calling Value.Interface on it. What do you see instead? The reflect.Value, rather than the value it represents, is still used to derive the receiver on each call even after you remove the value from reflection land. This could be seen as being in keeping with "The arguments to a Call on the returned function should not include a receiver; the returned function will always use v as the receiver." The potentially surprising implications of this could be clarified though, since the focus of this statement appears to be on the fact that you don't need to provide your own receiver on each call, rather than on a deviation of the behaviour of the method from the language feature it approximates.