]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify that f(g()) requires that g return >= 1 value
authorRuss Cox <rsc@golang.org>
Sat, 9 Feb 2013 19:46:55 +0000 (14:46 -0500)
committerRuss Cox <rsc@golang.org>
Sat, 9 Feb 2013 19:46:55 +0000 (14:46 -0500)
Fixes #4573.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7322043

doc/go_spec.html

index b8502bd5a76f187aa42c384f6efac26633b55162..30c9a9766cd483fce876199bd6a6f621e8fabea0 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of January 21, 2013",
+       "Subtitle": "Version of February 9, 2013",
        "Path": "/ref/spec"
 }-->
 
@@ -2765,13 +2765,14 @@ causes a <a href="#Run_time_panics">run-time panic</a>.
 </p>
 
 <p>
-As a special case, if the return parameters of a function or method
+As a special case, if the return values of a function or method
 <code>g</code> are equal in number and individually
 assignable to the parameters of another function or method
 <code>f</code>, then the call <code>f(g(<i>parameters_of_g</i>))</code>
 will invoke <code>f</code> after binding the return values of
 <code>g</code> to the parameters of <code>f</code> in order.  The call
-of <code>f</code> must contain no parameters other than the call of <code>g</code>.
+of <code>f</code> must contain no parameters other than the call of <code>g</code>,
+and <code>g</code> must have at least one return value.
 If <code>f</code> has a final <code>...</code> parameter, it is
 assigned the return values of <code>g</code> that remain after
 assignment of regular parameters.