mirror of https://github.com/golang/go.git
spec: clarify that f(g()) requires that g return >= 1 value
Fixes #4573. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7322043
This commit is contained in:
parent
e0791a3adf
commit
1b3083e68d
|
|
@ -1,6 +1,6 @@
|
||||||
<!--{
|
<!--{
|
||||||
"Title": "The Go Programming Language Specification",
|
"Title": "The Go Programming Language Specification",
|
||||||
"Subtitle": "Version of January 21, 2013",
|
"Subtitle": "Version of February 9, 2013",
|
||||||
"Path": "/ref/spec"
|
"Path": "/ref/spec"
|
||||||
}-->
|
}-->
|
||||||
|
|
||||||
|
|
@ -2765,13 +2765,14 @@ causes a <a href="#Run_time_panics">run-time panic</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<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
|
<code>g</code> are equal in number and individually
|
||||||
assignable to the parameters of another function or method
|
assignable to the parameters of another function or method
|
||||||
<code>f</code>, then the call <code>f(g(<i>parameters_of_g</i>))</code>
|
<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
|
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
|
<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
|
If <code>f</code> has a final <code>...</code> parameter, it is
|
||||||
assigned the return values of <code>g</code> that remain after
|
assigned the return values of <code>g</code> that remain after
|
||||||
assignment of regular parameters.
|
assignment of regular parameters.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue