From: Robert Griesemer
Date: Fri, 19 Sep 2014 20:32:07 +0000 (-0700)
Subject: spec: clarify panic behavior when deferring nil functions
X-Git-Tag: go1.4beta1~335
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b4eb22d76457bacc1b4131a31f9ae369a5f8f177;p=gostls13.git
spec: clarify panic behavior when deferring nil functions
Fixes #8107.
LGTM=iant, rsc, r
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/145960043
---
diff --git a/doc/go_spec.html b/doc/go_spec.html
index e8bb35f0b0..da1e2a5d24 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -5243,13 +5243,16 @@ Calls of built-in functions are restricted as for
-Each time the "defer" statement
+Each time a "defer" statement
executes, the function value and parameters to the call are
evaluated as usual
-and saved anew but the actual function body is not executed.
-Instead, deferred functions are executed immediately before
+and saved anew but the actual function is not invoked.
+Instead, deferred functions are invoked immediately before
the surrounding function returns, in the reverse order
they were deferred.
+If a deferred function value evaluates
+to nil
, execution panics
+when the function is invoked not when the "defer" statement is executed.