-
Notifications
You must be signed in to change notification settings - Fork 18k
spec: document nil checks for value methods #32035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is another bug I found in playing with this one #32021, which is closed. But I think there is also an inconsistency between reflection and direct code. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/cc @ianlancetaylor |
In the case So this is working as expected, in order to avoid a |
I would say this inconsistency needs to be documented better since it is surprising people who use Go. Please make this a documentation issue. |
In my opinion, the inconsistency in #32021 is more serious than the one is the current issue. I think, if it is possible, reflection code implementation and direct code implementation should be consistent with each other. Personally, I prefer the current reflection implementation way. |
If we document something, it would be a change to the language spec saying that you can not create a method value of a value method of a For interface types, you can not create a value method if the interface value is |
CC @griesemer |
I think this is clear specify in the spec for this behavior:
Also #47863 added example for how receiver is evaluated, can we close this issue now? cc @griesemer @mdempsky @ianlancetaylor |
What version of Go are you using (
go version
)?What did you do?
What did you expect to see?
Same behavior
What did you see instead?
Different behaviors.
The text was updated successfully, but these errors were encountered: