Skip to content

reflect: documentation doesn't state "<invalid value>" explicitly for some functions #13984

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

Closed
hirochachacha opened this issue Jan 17, 2016 · 1 comment

Comments

@hirochachacha
Copy link
Contributor

https://golang.org/pkg/reflect/#Value says:

The zero Value represents no value. Its IsValid method returns false, its Kind method returns Invalid, its String method returns "", and all other methods panic. Most functions and methods never return an invalid value. If one does, its documentation states the conditions explicitly.

But,

FieldByName, FieldByNameFunc, MapIndex, MethodByName, Recv, SetMapIndex, TryRecv

only say "it returns the zero Value if it's fail".

For example:

MethodByName returns a function value corresponding to the method of v with the given name. The arguments to a Call on the returned function should not include a receiver; the returned function will always use v as the receiver. It returns the zero Value if no method was found.

"the zero Value" seems ambiguous to me.

@hirochachacha
Copy link
Contributor Author

Sorry, I was mistaken.

@golang golang locked and limited conversation to collaborators Jan 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants