Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(272)

Issue 142320043: code review 142320043: spec: clarify variable declaration type rules (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 5 months ago by gri
Modified:
10 years, 5 months ago
Reviewers:
r, rsc, iant
CC:
r, rsc, iant, ken2, golang-codereviews
Visibility:
Public.

Description

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 issue 8088.

Patch Set 1 #

Patch Set 2 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Patch Set 3 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Total comments: 8

Patch Set 4 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Patch Set 5 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Patch Set 6 : diff -r 67bbd0083f7d8b423dfcac34c990d4dcedcca14f https://code.google.com/p/go/ #

Total comments: 2

Patch Set 7 : diff -r 35193bf04a5b64f361a1f88307188fa2d148566b https://code.google.com/p/go/ #

Total comments: 8

Patch Set 8 : diff -r 65257d85e6697175ebeaa6cc8ee9738f39ec9a27 https://code.google.com/p/go/ #

Patch Set 9 : diff -r 65257d85e6697175ebeaa6cc8ee9738f39ec9a27 https://code.google.com/p/go/ #

Total comments: 1

Patch Set 10 : diff -r 3d8bc2ff5bcfcc766f9388c47e8a1f162ae57522 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 11 : diff -r de559e236178124e0efa28d24dc1153d4007bbf5 https://code.google.com/p/go/ #

Total comments: 2

Patch Set 12 : diff -r 15c0b9f59a610db3924112eec0aeb7aa89106384 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -36 lines) Patch
M doc/go_spec.html View 1 2 3 4 5 6 7 8 9 10 11 8 chunks +51 lines, -36 lines 0 comments Download

Messages

Total messages: 17
gri
Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to ...
10 years, 5 months ago (2014-09-19 23:12:27 UTC) #1
r
https://codereview.appspot.com/142320043/diff/40001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/40001/doc/go_spec.html#newcode1878 doc/go_spec.html:1878: A variable declaration creates one or multiple variables, binds ...
10 years, 5 months ago (2014-09-19 23:19:12 UTC) #2
gri
Request for more feedback. https://codereview.appspot.com/142320043/diff/40001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/40001/doc/go_spec.html#newcode1878 doc/go_spec.html:1878: A variable declaration creates one ...
10 years, 5 months ago (2014-09-19 23:28:50 UTC) #3
gri
Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
10 years, 5 months ago (2014-09-19 23:45:44 UTC) #4
r
looks good https://codereview.appspot.com/142320043/diff/100001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/100001/doc/go_spec.html#newcode1880 doc/go_spec.html:1880: non-<a href="#The_zero_value">zero</a> initial value. you can optionally ...
10 years, 5 months ago (2014-09-23 21:07:32 UTC) #5
gri
PTAL https://codereview.appspot.com/142320043/diff/100001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/100001/doc/go_spec.html#newcode1880 doc/go_spec.html:1880: non-<a href="#The_zero_value">zero</a> initial value. On 2014/09/23 21:07:32, r ...
10 years, 5 months ago (2014-09-23 21:15:06 UTC) #6
iant
LGTM
10 years, 5 months ago (2014-09-24 23:52:33 UTC) #7
rsc
https://codereview.appspot.com/142320043/diff/120001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/120001/doc/go_spec.html#newcode1879 doc/go_spec.html:1879: identifiers to them, and gives each a type and ...
10 years, 5 months ago (2014-09-25 19:27:29 UTC) #8
gri
PTAL To avoid repetition I introduced the notion of an untyped constant's "default type" by ...
10 years, 5 months ago (2014-09-25 21:52:31 UTC) #9
iant
LGTM https://codereview.appspot.com/142320043/diff/160001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/160001/doc/go_spec.html#newcode601 doc/go_spec.html:601: An untyped constant has a <i>default type</i> which ...
10 years, 5 months ago (2014-09-26 23:55:18 UTC) #10
gri
PTAL
10 years, 5 months ago (2014-09-29 18:00:15 UTC) #11
r
https://codereview.appspot.com/142320043/diff/180001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/180001/doc/go_spec.html#newcode602 doc/go_spec.html:602: constant is implicitly converted in contexts where a typed ...
10 years, 5 months ago (2014-09-29 22:50:42 UTC) #12
gri
PTAL https://codereview.appspot.com/142320043/diff/180001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/180001/doc/go_spec.html#newcode602 doc/go_spec.html:602: constant is implicitly converted in contexts where a ...
10 years, 5 months ago (2014-09-29 23:37:27 UTC) #13
r
LGTM
10 years, 5 months ago (2014-09-30 17:46:22 UTC) #14
rsc
LGTM https://codereview.appspot.com/142320043/diff/200001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/200001/doc/go_spec.html#newcode1930 doc/go_spec.html:1930: if it is an untyped boolean value is ...
10 years, 5 months ago (2014-09-30 18:21:08 UTC) #15
gri
https://codereview.appspot.com/142320043/diff/200001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/142320043/diff/200001/doc/go_spec.html#newcode1930 doc/go_spec.html:1930: if it is an untyped boolean value is is ...
10 years, 5 months ago (2014-09-30 18:44:32 UTC) #16
gri
10 years, 5 months ago (2014-09-30 18:44:36 UTC) #17
*** Submitted as https://code.google.com/p/go/source/detail?r=4c137c3e4348 ***

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 issue 8088.

LGTM=iant, r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://codereview.appspot.com/142320043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b