-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: awkward wording of count mismatch error #22159
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
Comments
cannot set 2 variables to 3 values |
It looks like it used to say
Maybe |
assignment mismatch: 2 variables but 3 values That goes back to the original but at least doesn't use the cryptic 2 = 3. |
to 2 variables 3 values cannot be assigned |
to 2 variables 3 values assign you can not |
Three shall be the number of the values and the number of the values shall
be three. Four shalt thou not count, neither shalt thou count two,
excepting that thou hath two variables on the left hand side.
…On Thu, Oct 5, 2017 at 2:50 PM, Ian Lance Taylor ***@***.***> wrote:
to 2 variables 3 values assign you can not
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#22159 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGkgIOtQUaj6Afr3oxZLcRnI6VYxv94hks5spU8PgaJpZM4PvsqH>
.
|
@randall77 Sadly, that wording still puts the number of variables after the number of values (and the number of values + 1, and the number of values - 1), so it doesn't address @rsc's issue. 😭 |
Maybe change this to multi? I was just looking at the go/types version of this. It looks like go/types was changed to match cmd/compile: https://go-review.googlesource.com/c/go/+/38315 Bikeshedding: I thought |
Es ist verboten 2 Variablen 3 Werte zuzuweisen. |
|
Change https://golang.org/cl/68690 mentions this issue: |
The above change was submitted and properly attributed this issue. Not sure why this was not automatically closed. Closing now. |
Keep left-to-right order when referring to the number of variables and values involved. Fixes #22159. Change-Id: Iccca12d3222f9d5e049939a9ccec07513c393faa Reviewed-on: https://go-review.googlesource.com/68690 Reviewed-by: Russ Cox <rsc@golang.org>
Error from cmd/compile:
This is a correct statement (my code says
x, y := f()
wheref
has 3 results),but the numbers appear reversed from what's in the source code (2 variables = 3 values). Trying to keep the same left-to-right flow is part of the reason the old message said something like "assignment mismatch: 2 = 3". I appreciate that the old message is super-cryptic, and the new message is much clearer, but can you find some way to reword it so that the number 2 appears before the number 3?
/cc @griesemer @mdempsky
The text was updated successfully, but these errors were encountered: