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

Issue 104680043: code review 104680043: spec: permit "for range x" (no index variables) (Closed)

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

Description

spec: permit "for range x" (no index variables) This is a fully backward-compatible language change. There are not a lot of cases in the std library, but there are some. Arguably this makes the syntax a bit more regular - any trailing index variable that is _ can be left away, and there's some analogy to type switches where the temporary can be left away. Implementation-wise the change should be trivial as it can be done completely syntactically. For instance, the respective change in go/parser is a dozen lines (see https://codereview.appspot.com/112970044 ). Fixes issue 6102.

Patch Set 1 #

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

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

Total comments: 2

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

Total comments: 2

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -15 lines) Patch
M doc/go_spec.html View 1 2 3 4 4 chunks +19 lines, -15 lines 0 comments Download

Messages

Total messages: 8
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, 4 months ago (2014-07-10 21:30:33 UTC) #1
gri
PS: I am slightly in favor of this for the added regularity and because making ...
10 years, 4 months ago (2014-07-10 21:32:09 UTC) #2
iant
LGTM https://codereview.appspot.com/104680043/diff/40001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/104680043/diff/40001/doc/go_spec.html#newcode4738 doc/go_spec.html:4738: with one exception: If the range expression is ...
10 years, 4 months ago (2014-07-10 21:52:33 UTC) #3
gri
PTAL https://codereview.appspot.com/104680043/diff/40001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/104680043/diff/40001/doc/go_spec.html#newcode4738 doc/go_spec.html:4738: with one exception: If the range expression is ...
10 years, 4 months ago (2014-07-10 22:19:59 UTC) #4
r
LGTM
10 years, 3 months ago (2014-07-14 21:57:01 UTC) #5
rsc
LGTM I think of this as similar to not requiring the _ in switch _ ...
10 years, 3 months ago (2014-07-14 22:02:05 UTC) #6
gri
https://codereview.appspot.com/104680043/diff/60001/doc/go_spec.html File doc/go_spec.html (left): https://codereview.appspot.com/104680043/diff/60001/doc/go_spec.html#oldcode4817 doc/go_spec.html:4817: for i, _ := range testdata.a { On 2014/07/14 ...
10 years, 3 months ago (2014-07-14 22:06:03 UTC) #7
gri
10 years, 3 months ago (2014-07-14 22:08:14 UTC) #8
*** Submitted as https://code.google.com/p/go/source/detail?r=fcb7e7aa1740 ***

spec: permit "for range x" (no index variables)

This is a fully backward-compatible language change.

There are not a lot of cases in the std library, but
there are some. Arguably this makes the syntax a bit
more regular - any trailing index variable that is _
can be left away, and there's some analogy to type
switches where the temporary can be left away.

Implementation-wise the change should be trivial as
it can be done completely syntactically. For instance,
the respective change in go/parser is a dozen lines
(see https://codereview.appspot.com/112970044 ).

Fixes issue 6102.

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

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