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

Issue 6736071: code review 6736071: spec: clarify returns, defer statements, and panics (Closed)

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

Description

spec: clarify returns, defer statements, and panics This is an attempt at making the interaction between these three constructs clearer. Specifically: - return statements terminate a function, execute deferred functions, return to the caller, and then execution continues after the call - panic calls terminate a function, execute deferred functions, return to the caller, and then re-panic - deferred functions are executed before a function _returns_ to its caller The hope is that with this change it becomes clear when a deferred function is executed (when a function returns), and when it is not (when a program exits).

Patch Set 1 #

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

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

Total comments: 6

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

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

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

Total comments: 2

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

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

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

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

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

Messages

Total messages: 10
gri
Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to ...
12 years, 5 months ago (2012-10-23 22:40:57 UTC) #1
iant
https://codereview.appspot.com/6736071/diff/4001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6736071/diff/4001/doc/go_spec.html#newcode4547 doc/go_spec.html:4547: continues with the statement immediately following the call of ...
12 years, 5 months ago (2012-10-23 23:14:58 UTC) #2
gri
PTAL. https://codereview.appspot.com/6736071/diff/4001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6736071/diff/4001/doc/go_spec.html#newcode4547 doc/go_spec.html:4547: continues with the statement immediately following the call ...
12 years, 5 months ago (2012-10-23 23:31:15 UTC) #3
iant2
On Tue, Oct 23, 2012 at 4:31 PM, <gri@golang.org> wrote: > > > https://codereview.appspot.com/6736071/diff/4001/doc/go_spec.html#newcode4617 > ...
12 years, 5 months ago (2012-10-23 23:38:15 UTC) #4
gri
Thanks. Done. PTAL. - gri On Tue, Oct 23, 2012 at 4:38 PM, Ian Lance ...
12 years, 5 months ago (2012-10-23 23:52:34 UTC) #5
iant
LGTM https://codereview.appspot.com/6736071/diff/16001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6736071/diff/16001/doc/go_spec.html#newcode4618 doc/go_spec.html:4618: function. A "return" statement that specifies results sets ...
12 years, 5 months ago (2012-10-24 00:08:26 UTC) #6
gri
https://codereview.appspot.com/6736071/diff/16001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6736071/diff/16001/doc/go_spec.html#newcode4618 doc/go_spec.html:4618: function. A "return" statement that specifies results sets the ...
12 years, 5 months ago (2012-10-24 00:10:52 UTC) #7
r
LGTM
12 years, 5 months ago (2012-10-26 16:28:39 UTC) #8
rsc
LGTM
12 years, 4 months ago (2012-11-01 16:25:42 UTC) #9
gri
12 years, 4 months ago (2012-11-01 17:13:50 UTC) #10
*** Submitted as http://code.google.com/p/go/source/detail?r=632ca9d98436 ***

spec: clarify returns, defer statements, and panics

This is an attempt at making the interaction between
these three constructs clearer. Specifically:

- return statements terminate a function, execute deferred
  functions, return to the caller, and then execution
  continues after the call

- panic calls terminate a function, execute deferred
  functions, return to the caller, and then re-panic

- deferred functions are executed before a function _returns_
  to its caller

The hope is that with this change it becomes clear when a
deferred function is executed (when a function returns),
and when it is not (when a program exits).

R=r, rsc, iant, ken, iant
CC=golang-dev
http://codereview.appspot.com/6736071
Sign in to reply to this message.

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