spec: terminating statements for functions
The only functional change is the new section
on terminating statements.
There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).
Includes some minor fixes/additions of missing links.
Based closely on Russ' proposal.
Fixes issue 65.
Waiting for comments from more people. https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3887 doc/go_spec.html:3887: <li>both branches are ...
On Mon, Mar 4, 2013 at 9:31 AM, <gri@golang.org> wrote:
> Waiting for comments from more people.
>
>
>
>
>
https://codereview.appspot.**com/7415050/diff/13001/doc/go_**spec.html<https:...
> File doc/go_spec.html (right):
>
> https://codereview.appspot.**com/7415050/diff/13001/doc/go_**
>
spec.html#newcode3887<https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3887>
> doc/go_spec.html:3887: <li>both branches are terminating
> statements.</li>
> On 2013/03/04 06:06:33, bradfitz wrote:
>
>> s/both/all/ ?
>>
>
> There are exactly two branches (at the way this rule is formulated), so
> I wanted to highlight that. But not feeling strongly.
>
yeah, I realized that after I mailed that. "both" is better.
LGTM https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3929 doc/go_spec.html:3929: Flow of control does not continue past a ...
Any other takers? https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3929 doc/go_spec.html:3929: Flow of control does not continue ...
Any other takers?
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html
File doc/go_spec.html (right):
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3929
doc/go_spec.html:3929: Flow of control does not continue past a terminating
statement.
On 2013/03/04 18:06:28, rsc wrote:
> This is true, but it doesn't seem to be used anywhere. I think it might be too
> easy to misread as saying the reverse, namely that if flow of control does not
> continue past a statement, then it is a terminating statement (not true), so
I'm
> inclined to drop this.
Done.
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode1472 doc/go_spec.html:1472: A <i>block</i> is a (possibly empty) sequence of declarations ...
PTAL https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode1472 doc/go_spec.html:1472: A <i>block</i> is a (possibly empty) sequence of ...
PTAL
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html
File doc/go_spec.html (right):
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode1472
doc/go_spec.html:1472: A <i>block</i> is a (possibly empty) sequence of
declarations and statements
On 2013/03/04 18:35:54, r wrote:
> drop the parens.
Done.
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3878
doc/go_spec.html:3878: A <a href="#Blocks">block</a> in which the statement list
ends in a terminating statement.
On 2013/03/04 18:35:54, r wrote:
> "ends" isn't well-defined.
> A block with a non-empty statement list in which the final statement of the
list
> is a terminating statement.
Added extra sentence defining what "ends" means instead since it's used not just
here but below as well.
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3887
doc/go_spec.html:3887: <li>both branches are terminating statements.</li>
On 2013/03/04 18:35:54, r wrote:
> it's a bit subtle because of 'if .. else if .. else if .. else if ..', but i
> believe 'both' is correct.
yes. The if-syntax has two branches.
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3895
doc/go_spec.html:3895: <li>there is no explicit loop condition.</li>
On 2013/03/04 18:35:54, r wrote:
> "no" isn't quite the same as empty. also there's this:
>
> for true { }
>
> which the rule does not (and should not) define as a terminating statement.
>
> i think you want to say
>
> the loop condition is missing or empty
>
> which is very clear.
Don't quite agree. "true" is an explicit loop condition. "Missing or empty"
implies that it can be missing, or it can be empty, and I don't know what
"empty" means if not "missing". Rephrased to:
"the loop condition is absent."
This is the wording used in the spec for "for".
https://codereview.appspot.com/7415050/diff/13001/doc/go_spec.html#newcode3905
doc/go_spec.html:3905: or <a href="#Fallthrough_statements">"fallthrough"
statement</a>.</li>
On 2013/03/04 18:35:54, r wrote:
> possibly labeled fallthrough statement
Done.
LGTM Still looks good to me, but wait for Rob. https://codereview.appspot.com/7415050/diff/23001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/23001/doc/go_spec.html#newcode3931 ...
PTAL https://codereview.appspot.com/7415050/diff/23001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/23001/doc/go_spec.html#newcode3931 doc/go_spec.html:3931: is not empty and if its final statement ...
LGTM https://codereview.appspot.com/7415050/diff/13002/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13002/doc/go_spec.html#newcode3859 doc/go_spec.html:3859: A terminating statement is one the the following: ...
https://codereview.appspot.com/7415050/diff/13002/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/7415050/diff/13002/doc/go_spec.html#newcode3859 doc/go_spec.html:3859: A terminating statement is one the the following: On ...
*** Submitted as https://code.google.com/p/go/source/detail?r=763763e16eb3 *** spec: terminating statements for functions The only functional change is ...
*** Submitted as https://code.google.com/p/go/source/detail?r=763763e16eb3 ***
spec: terminating statements for functions
The only functional change is the new section
on terminating statements.
There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).
Includes some minor fixes/additions of missing links.
Based closely on Russ' proposal.
Fixes issue 65.
R=rsc, r, iant, ken, bradfitz
CC=golang-dev
https://codereview.appspot.com/7415050
Issue 7415050: code review 7415050: spec: terminating statements for functions
(Closed)
Created 12 years ago by gri
Modified 12 years ago
Reviewers:
Base URL:
Comments: 18