]> Cypherpunks repositories - gostls13.git/commit
spec: clarify variable declaration type rules
authorRobert Griesemer <gri@golang.org>
Tue, 30 Sep 2014 18:44:29 +0000 (11:44 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 30 Sep 2014 18:44:29 +0000 (11:44 -0700)
commit47094dcf09ca5dce1ae76bbb3a4e4311c552fd7b
tree6188d98c4d6610d971b22bd472e412ade368482b
parentc017a4e118c9574c0b1eefa661b46bf81ab6e7c2
spec: clarify variable declaration type rules

Not a language change.

Several inaccuracies were fixed:

1) A variable declaration may declare more than just one
variable.

2) Variable initialization follows the rules of assignments,
including n:1 assignments. The existing wording implied a 1:1
or n:n rule and generally was somewhat unspecific.

3) The rules for variable declarations with no types and
untyped initialization expressions had minor holes (issue 8088).

4) Clarified the special cases of assignments of untyped values
(we don't just have untyped constants, but also untyped bools,
e.g. from comparisons). The new wording is more direct.

To that end, introduced the notion of an untyped constant's
"default type" so that the same concept doesn't have to be
repeatedly introduced.

Fixes #8088.

LGTM=iant, r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/142320043
doc/go_spec.html