gopherjs
gopherjs copied to clipboard
Multiple assignment is evaluated in wrong order
Full example: https://gopherjs.github.io/playground/#/6geYC_5FAf
In the following code:
x[f()] = g()
f should be called before g but isn't. This matters in presence of side-effects.
Spec: https://golang.org/ref/spec#Assignments https://golang.org/ref/spec#Order_of_evaluation
cc @dsnet
This is probably related, and possibly even a duplicate, of #608
Agree that #608 may be related. Don't think it's a duplicate. As I commented there, I think GopherJS is within the spec, which is explicitly vague on the code in that issue.
For the code in this issue it's much more concrete: f() should be evaluated before g(). (When x is evaluated is not specified; it could be before f, between f & g, or after g. Which would be important if f or g modify x.)