-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: reject (some) redundant expressions #27775
Comments
// compile without error
// should be an error -> all constant comparisions like this have no meaning.
_ = 1 == 2
_ = 1 != 2.0
_ = true == true
_ = true != false I can agree with this one. I've always wondered why the compiler allows things like |
I disagree that these expressions should always be simplified. Stylistically, it can be helpful to include an explicit zero in some cases involving repetitive statements. For example,
|
It's not always apparent which identifiers are constants, or which constants are constant across all architectures and tags. |
As a proposal this needs more detail.
|
i don't understand why most of these "should be" errors. i would absolutely use I would tend to allow things like |
Per comments above, we aren't going to do this. |
Hi,
I love golang for simplicity and explicitness. But there are a few cases when a developer can write the same code in different ways. Why not restrict syntax (in Go2) only to one possible option.
The text was updated successfully, but these errors were encountered: