You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section of the spec:
http://golang.org/ref/spec#Program_initialization_and_execution states that 'var'
declarations are initialized in topological order, tracing through functions and
definitions. (The term used is "data-dependent" order which I think is
incorrect because the order is an entirely static property of the topology of the
reference graph, not dependent on values.)
It says that two items not related by this partial order are initialized "in the
order they appear in the source". I assume (and gri and iant concur) that this is
another partial order such that two vars in the same file are ordered but two vars in
different files of the same package are unordered. It would be good to be more explicit
about this.
iant adds: "Since there
is no explicit dependence between the variables in different files, in
principle it should not matter what order they are initialized in,
although of course it is possible to construct cases where it does
matter."
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: