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: - symbol #52415

Closed
switchupcb opened this issue Apr 18, 2022 · 1 comment
Closed

proposal: - symbol #52415

switchupcb opened this issue Apr 18, 2022 · 1 comment
Labels
error-handling Language & library change proposals that are about error handling. FrozenDueToAge LanguageChange Suggested changes to the Go language Proposal v2 An incompatible library change
Milestone

Comments

@switchupcb
Copy link

Add an assignment symbol (-) that returns a named variable if it's not it's zero value. This is definitely NOT an error proposal. If you think it is, I know a doctor who can check your eyes for you. For free! Call me, 😉.

The zero value of an error (which is a value) is nil.

func bezo(baller, dollers string) error {
    bucko, - := strconv.Atoi(baller)
    bucks, _ := strconv.Atoi(dollers)
    fmt.Println("$:", bucko + bucks)

    return nil
}

The supreme art of war is to subdue the enemy without fighting. Let them handle their errors.
— Sun Tzu

Implications: #52380

@gopherbot gopherbot added this to the Proposal milestone Apr 18, 2022
@ianlancetaylor ianlancetaylor added LanguageChange Suggested changes to the Go language v2 An incompatible library change labels Apr 18, 2022
@ianlancetaylor
Copy link
Contributor

I'm sorry, this is clearly not going to happen. The - and _ symbols look too similar to have such radically different effects. And nothing in Go permits change in flow of control based on an operator. I could run the proposal through the whole process, but frankly that would just be wasting people's time. I'm going to close out this issue. Sorry.

I encourage you to discuss language issues in a forum like golang-nuts rather than by filing proposal issues. Thanks.

@seankhliao seankhliao added the error-handling Language & library change proposals that are about error handling. label May 18, 2022
@golang golang locked and limited conversation to collaborators May 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
error-handling Language & library change proposals that are about error handling. FrozenDueToAge LanguageChange Suggested changes to the Go language Proposal v2 An incompatible library change
Projects
None yet
Development

No branches or pull requests

4 participants