]> Cypherpunks repositories - gostls13.git/commitdiff
go spec: clarify rules for append, scope rules for :=
authorRobert Griesemer <gri@golang.org>
Sun, 12 Jun 2011 19:09:50 +0000 (12:09 -0700)
committerRobert Griesemer <gri@golang.org>
Sun, 12 Jun 2011 19:09:50 +0000 (12:09 -0700)
Fixes #1936.
Fixes #1940.

R=rsc, r, iant, ken, iant
CC=golang-dev
https://golang.org/cl/4585049

doc/go_spec.html

index abf5b8f50effbe0771c3910ab8f036228a6a7e35..a6680ee816c0129310ff4f232292d288403f47b8 100644 (file)
@@ -1,5 +1,5 @@
 <!-- title The Go Programming Language Specification -->
-<!-- subtitle Version of June 7, 2011 -->
+<!-- subtitle Version of June 10, 2011 -->
 
 <!--
 TODO
@@ -10,7 +10,6 @@ TODO
 [ ] clarify what a field name is in struct declarations
     (struct{T} vs struct {T T} vs struct {t T})
 [ ] need explicit language about the result type of operations
-[ ] should string(1<<s) and float32(1<<s) be valid?
 [ ] should probably write something about evaluation order of statements even
        though obvious
 [ ] review language on implicit dereferencing
@@ -1452,6 +1451,7 @@ Go is lexically scoped using blocks:
 
        <li>The scope of a constant or variable identifier declared
            inside a function begins at the end of the ConstSpec or VarSpec
+           (ShortVarDecl for short variable declarations)
            and ends at the end of the innermost containing block.</li>
 
        <li>The scope of a type identifier declared inside a function
@@ -4590,11 +4590,14 @@ 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 <a href="#Function_types">variadic</a> function <code>append</code>
+appends zero or more values <code>x</code>
 to <code>s</code> of type <code>S</code>, which must be a slice type, and
 returns the resulting slice, also of type <code>S</code>.
-Each value <code>x</code> must be <a href="#Assignability">assignable</a> to
-the <a href="#Slice_types">element type</a> of <code>S</code>.
+The values <code>x</code> are passed to a parameter of type <code>...T</code>
+where <code>T</code> is the <a href="#Slice_types">element type</a> of
+<code>S</code> and the respective
+<a href="#Passing_arguments_to_..._parameters">parameter passing rules</a> apply.
 </p>
 
 <pre class="grammar">