Skip to content
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: Error-Handling Paradigm with !err Grammar Sugar #62253

Closed
shynome opened this issue Aug 23, 2023 · 11 comments
Closed

proposal: Go 2: Error-Handling Paradigm with !err Grammar Sugar #62253

shynome opened this issue Aug 23, 2023 · 11 comments
Labels
error-handling Language & library change proposals that are about error handling. LanguageChange Proposal v2 A language change or incompatible library change
Milestone

Comments

@shynome
Copy link

shynome commented Aug 23, 2023

Hi, if you like this idea please give a heart emoji to me, Thank you very much

//  before, 4 line
f, err := os.Open()
if err != nil {
  return
}

// now, 1 line
f, !err := os.Open()

I plan to impl this by gone-lang, your like emoji can speed development

@gopherbot gopherbot added this to the Proposal milestone Aug 23, 2023
@ianlancetaylor ianlancetaylor added the error-handling Language & library change proposals that are about error handling. label Aug 23, 2023
@ianlancetaylor
Copy link
Contributor

ianlancetaylor commented Aug 23, 2023

Similar to #25273, #32500, #32884, #33074, #33150. See also #40432.

@ianlancetaylor ianlancetaylor added LanguageChange v2 A language change or incompatible library change labels Aug 23, 2023
@shynome
Copy link
Author

shynome commented Aug 23, 2023

I think my proposal has the least broken

@seankhliao
Copy link
Member

Duplicate of #14066

@seankhliao seankhliao marked this as a duplicate of #14066 Aug 23, 2023
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
@shynome
Copy link
Author

shynome commented Aug 23, 2023

@seankhliao I don't know why you just because of they looks similar then close this, this has diffrence, this issue add limit for sugar so it easy to implement

@ianlancetaylor
Copy link
Contributor

We have rejected many issues that are very similar, if not identical, to this one. Just as those were not accepted, we aren't going to accept this one. As I mentioned, please see #40432. Sorry.

@shynome
Copy link
Author

shynome commented Aug 23, 2023

so much proposal, can we make an vote to known which proposal is much popular?
I really hate go error handle, so much template code

@ianlancetaylor
Copy link
Contributor

Sorry, we don't make changes to the Go language on the basis of voting.

We are aware that error handling boilerplate is a concern. There have been many, many, proposals to address it. There has been an enormous amount of discussion on the topic.

@shynome
Copy link
Author

shynome commented Aug 23, 2023

here is my try: https://github.com/shynome/err4 .implement this by use code generate.

I'm so sorry for what I said. I didn't mean to hurt your feelings.

@ianlancetaylor
Copy link
Contributor

No worries.

@shynome
Copy link
Author

shynome commented Aug 26, 2023

#14066 (comment)

I think the Proposal-Decline reason does not apply now, This year is 2023 not 2016, this year we have got generic type, a change bigger than this proposal, golang team can consider this again

@ianlancetaylor
Copy link
Contributor

We've identified many similar issues. They have all been closed. This isn't an approach we are likely to take with Go. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-handling Language & library change proposals that are about error handling. LanguageChange Proposal v2 A language change or incompatible library change
Projects
None yet
Development

No branches or pull requests

4 participants