1
0
mirror of https://github.com/golang/go synced 2024-11-23 13:40:04 -07:00
go/doc
Robert Griesemer 259f0ffade spec: specify variable initialization order explicitly
The existing spec rules on package initialization were
contradictory: They specified that 1) dependent variables
are initialized in dependency order, and 2) independent
variables are initialized in declaration order. This 2nd
rule cannot be satisfied in general. For instance, for

var (
        c = b + 2
        a = 0
        b = 1
)

because of its dependency on b, c must be initialized after b,
leading to the partial order b, c. Because a is independent of
b but is declared before b, we end up with the order: a, b, c.
But a is also independent of c and is declared after c, so the
order b, c, a should also be valid in contradiction to a, b, c.

The new rules are given in form of an algorithm which outlines
initialization order explicitly.

gccgo and go/types already follow these rules.

Fixes #8485.

LGTM=iant, r, rsc
R=r, rsc, iant, ken, gordon.klaus, adonovan
CC=golang-codereviews
https://golang.org/cl/142880043
2014-09-29 12:44:50 -07:00
..
articles build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
codewalk doc: fix typo in sharemem codewalk 2014-05-21 14:34:20 -07:00
devel doc: document Go 1.3.2 2014-09-26 11:00:49 +10:00
gopher doc/gopher: add biplane.jpg 2014-09-25 14:10:56 -07:00
play doc: remove godocs.js and playground.js from core repo 2013-08-01 15:09:18 +10:00
progs doc/progs: don't try building cgo tests if CGO_ENABLED=0 2013-10-11 08:55:13 -07:00
asm.html all: copy cmd/ld/textflag.h into pkg/GOOS_GOARCH 2014-08-12 17:04:45 -07:00
cmd.html doc/cmd.html: close a tag. 2014-08-26 05:26:48 -07:00
code.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
contrib.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
contribute.html build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
debugging_with_gdb.html build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
docs.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
effective_go.html build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
gccgo_contribute.html build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
gccgo_install.html doc: fix broken link to RTEMS Go wiki page 2014-04-28 06:27:22 -07:00
go1.1.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
go1.2.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
go1.3.html doc: document new ParseMultipartForm behavior 2014-08-07 15:42:06 +10:00
go1.4.txt doc/go1.4: go test builds + links all test files (CL 150980043) 2014-09-26 17:09:40 -04:00
go1.html doc: link directly to https://golang.org/dl/ 2014-09-12 09:15:58 +10:00
go1compat.html doc/compat1.html: link to go.sys 2014-08-12 15:45:35 -07:00
go_faq.html doc/faq: update for 1.4 2014-09-27 11:56:54 -07:00
go_mem.html doc: fix happens-before rules for buffered channels 2014-06-05 21:08:28 +04:00
go_spec.html spec: specify variable initialization order explicitly 2014-09-29 12:44:50 -07:00
go-logo-black.png
go-logo-blue.png
go-logo-white.png
help.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
ie.css
install-source.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
install.html doc: link directly to https://golang.org/dl/ 2014-09-12 09:15:58 +10:00
logo-153x55.png
root.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00
share.png
sieve.gif
tos.html doc: drop scheme from links that are known to support HTTPS 2014-07-25 10:28:39 +10:00