diff --git a/doc/go_spec.html b/doc/go_spec.html index 8bf6c2195a2..d7b0d763266 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -4493,9 +4515,11 @@ DeferStmt = "defer" Expression .
The expression must be a function or method call. Each time the "defer" statement -executes, the parameters to the function call are evaluated and saved anew but the -function is not invoked. -Deferred function calls are executed in LIFO order +executes, the function value and parameters to the call are +evaluated as usual +and saved anew but the +actual function is not invoked. +Instead, deferred calls are executed in LIFO order immediately before the surrounding function returns, after the return values, if any, have been evaluated, but before they are returned to the caller. For instance, if the deferred function is @@ -4503,6 +4527,8 @@ a function literal and the surrounding function has named result parameters that are in scope within the literal, the deferred function may access and modify the result parameters before they are returned. +If the deferred function has any return values, they are discarded when +the function completes.
@@ -5355,9 +5381,7 @@ A struct or array type has size zero if it contains no fields (or elements, resp
-
Implementation differences - TODO
- len(a)
is only a constant if a
is a (qualified) identifier denoting an array or pointer to an array.
+ len(x)
is only a constant if x
is a (qualified) identifier denoting an array or pointer to an array.
-