]> Cypherpunks repositories - gostls13.git/commitdiff
spec: minor adjustment of prose in composite literal section
authorRobert Griesemer <gri@golang.org>
Wed, 23 Sep 2015 00:47:38 +0000 (17:47 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 23 Sep 2015 21:26:10 +0000 (21:26 +0000)
The prose discussing composite literals referred to the composite
literal type with 'LiteralType', denoting the literal type's EBNF
production explicitly. Changed 'LiteralType' to 'literal type' to
remove the literal (no pun intended) connection and instead mean
the underlying type. Seems a simpler and more readable change
than referring to the underlying type everywhere explicitly.

Fixes #12717.

Change-Id: I225df95f9ece2664b19068525ea8bda5ca05a44a
Reviewed-on: https://go-review.googlesource.com/14851
Reviewed-by: Rob Pike <r@golang.org>
doc/go_spec.html

index 7de0c7b716ab3cf5a01232a13cd38b227065b3ac..6c4eac152d92fb2f43a5ac901bfe3f6cb79712e3 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of September 11, 2015",
+       "Subtitle": "Version of September 24, 2015",
        "Path": "/ref/spec"
 }-->
 
@@ -2210,7 +2210,7 @@ math.Sin  // denotes the Sin function in package math
 <p>
 Composite literals construct values for structs, arrays, slices, and maps
 and create a new value each time they are evaluated.
-They consist of the type of the value followed by a brace-bound list of elements.
+They consist of the type of the literal followed by a brace-bound list of elements.
 Each element may optionally be preceded by a corresponding key.
 </p>
 
@@ -2227,11 +2227,11 @@ Element       = Expression | LiteralValue .
 </pre>
 
 <p>
-The LiteralType must be a struct, array, slice, or map type
+The LiteralType's underlying type must be a struct, array, slice, or map type
 (the grammar enforces this constraint except when the type is given
 as a TypeName).
 The types of the elements and keys must be <a href="#Assignability">assignable</a>
-to the respective field, element, and key types of the LiteralType;
+to the respective field, element, and key types of the literal type;
 there is no additional conversion.
 The key is interpreted as a field name for struct literals,
 an index for array and slice literals, and a key for map literals.
@@ -2244,7 +2244,7 @@ constant key value.
 For struct literals the following rules apply:
 </p>
 <ul>
-       <li>A key must be a field name declared in the LiteralType.
+       <li>A key must be a field name declared in the struct type.
        </li>
        <li>An element list that does not contain any keys must
            list an element for each struct field in the
@@ -2306,7 +2306,7 @@ var pointer *Point3D = &amp;Point3D{y: 1000}
 </pre>
 
 <p>
-The length of an array literal is the length specified in the LiteralType.
+The length of an array literal is the length specified in the literal type.
 If fewer elements than the length are provided in the literal, the missing
 elements are set to the zero value for the array element type.
 It is an error to provide elements with index values outside the index range