diff --git a/doc/go_spec.html b/doc/go_spec.html index 5872eefb03..c71126d25d 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -738,7 +738,7 @@ The method set of any other type T consists of all The method set of the corresponding pointer type *T is the set of all methods declared with receiver *T or T (that is, it also contains the method set of T). -Further rules apply to structs containing anonymous fields, as described +Further rules apply to structs containing embedded fields, as described in the section on struct types. Any other type has an empty method set. In a method set, each method must have a @@ -947,16 +947,16 @@ Moreover, the inner slices must be initialized individually.

A struct is a sequence of named elements, called fields, each of which has a name and a type. Field names may be specified explicitly (IdentifierList) or -implicitly (AnonymousField). +implicitly (EmbeddedField). Within a struct, non-blank field names must be unique.

-StructType     = "struct" "{" { FieldDecl ";" } "}" .
-FieldDecl      = (IdentifierList Type | AnonymousField) [ Tag ] .
-AnonymousField = [ "*" ] TypeName .
-Tag            = string_lit .
+StructType    = "struct" "{" { FieldDecl ";" } "}" .
+FieldDecl     = (IdentifierList Type | EmbeddedField) [ Tag ] .
+EmbeddedField = [ "*" ] TypeName .
+Tag           = string_lit .
 
@@ -974,16 +974,15 @@ struct {
 

-A field declared with a type but no explicit field name is an anonymous field, -also called an embedded field or an embedding of the type in the struct. -An embedded type must be specified as +A field declared with a type but no explicit field name is called an embedded field. +An embedded field must be specified as a type name T or as a pointer to a non-interface type name *T, and T itself may not be a pointer type. The unqualified type name acts as the field name.

-// A struct with four anonymous fields of type T1, *T2, P.T3 and *P.T4
+// A struct with four embedded fields of types T1, *T2, P.T3 and *P.T4
 struct {
 	T1        // field name is T1
 	*T2       // field name is T2
@@ -1000,15 +999,15 @@ in a struct type:
 
 
 struct {
-	T     // conflicts with anonymous field *T and *P.T
-	*T    // conflicts with anonymous field T and *P.T
-	*P.T  // conflicts with anonymous field T and *T
+	T     // conflicts with embedded field *T and *P.T
+	*T    // conflicts with embedded field T and *P.T
+	*P.T  // conflicts with embedded field T and *T
 }
 

A field or method f of an -anonymous field in a struct x is called promoted if +embedded field in a struct x is called promoted if x.f is a legal selector that denotes that field or method f.

@@ -1025,7 +1024,7 @@ promoted methods are included in the method set of the struct as follows: