1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:24:45 -07:00

go spec: clarify return type of append, argument type for ...T parameters

R=iant, ken2, r, rsc
CC=golang-dev
https://golang.org/cl/2774041
This commit is contained in:
Robert Griesemer 2010-10-27 10:44:31 -07:00
parent ad7d24ac4b
commit 904adfdc46

View File

@ -1,5 +1,5 @@
<!-- title The Go Programming Language Specification --> <!-- title The Go Programming Language Specification -->
<!-- subtitle Version of Oct 26, 2010 --> <!-- subtitle Version of Oct 27, 2010 -->
<!-- <!--
TODO TODO
@ -2639,9 +2639,9 @@ within <code>Greeting</code>, <code>who</code> will have the value
</p> </p>
<p> <p>
If the final argument is of slice type <code>[]T</code>, it may be passed unchanged as the value If the final argument is assignable to a slice type <code>[]T</code>, it may be
for a <code>...T</code> parameter if the argument is followed by <code>...</code>. passed unchanged as the value for a <code>...T</code> parameter if the argument
In this case no new slice is created. is followed by <code>...</code>. In this case no new slice is created.
</p> </p>
<p> <p>
@ -4535,12 +4535,13 @@ Two built-in functions assist in common slice operations.
<p> <p>
The function <code>append</code> appends zero or more values <code>x</code> The function <code>append</code> appends zero or more values <code>x</code>
to a slice <code>s</code> and returns the resulting slice. Each value must be to a slice <code>s</code> and returns the resulting slice, with the same type
<a href="#Assignability">assignable</a> to the slice's element type. as s. Each value must be <a href="#Assignability">assignable</a> to the slice's
element type.
</p> </p>
<pre class="grammar"> <pre class="grammar">
append(s []T, x ...T) []T append(s S, x ...T) S // S is assignable to []T
</pre> </pre>
<p> <p>