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

spec: clarify section on initialization order #31292

griesemer opened this Issue Apr 5, 2019 · 2 comments


None yet
2 participants
Copy link

commented Apr 5, 2019

See #22326 for a discussion of a specific example and how the spec might be unclear. See specifically #22326 (comment) .

Issues with the section on initialization order:

  • The very first sentence may imply an algorithm that is different from the one explained by 2nd, more detailed paragraph.
  • The section talks about declaration order, but variables named _ are "never declared" (yet they are processed for initialization order like any other variable).
  • The section could use one or two more examples.

This comment has been minimized.

Copy link

commented Apr 15, 2019

While we wait for a spec CL to improve the wording / examples, I think it's worth at least ensuring we're in agreement about the intended understanding.

  1. Are we agreed upon the total ordering* implied by the algorithm specified in the second paragraph? (* I think it's a total ordering at least.)

  2. Are we agreed that var _ = ... and var uniqueUnusedName = ... should behave identically?

If agreed on both, based on fuzzing I've done, I think go/types and gccgo are both spec compliant, and I have a revision for CL 170062 to bring it into compliance as well.


This comment has been minimized.

Copy link

commented Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.