-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: Go 2: Implicit zero-return-value #47008
Labels
Milestone
Comments
See #21182 (which I quite like, but which doesn't seem to be very popular). |
dup of #19642 ? |
I don't think that it's an exact duplicate. That was allowing it in any RHS usage, while this seems to be only in |
In any case I think it’s fair to say that this proposal is reasonably well covered by existing issues. What do you think, @leonklingele ? |
Closing as a dup of any of the aforementioned issues. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For example, having a func returning
(int, error)
, it's quite cumbersome to always explicitly return a zero-valued integer in case of an error:Using named return values instead makes this a bit easier (but they seem overly complicated and error-prone):
What would be more useful, beautiful, is using an underscore (
_
) to implicitly return the zero-value of a return parameter — a don't-care value:Has this been proposed before?
The text was updated successfully, but these errors were encountered: