diff --git a/doc/go_spec.html b/doc/go_spec.html index 9865227c22..479605e36c 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -1856,110 +1856,10 @@ The underlying type of []B1, B3, and B4 i The underlying type of P is interface{}.

-

Core types

- -

-Each non-interface type T has a core type, which is the same as the -underlying type of T. -

- -

-An interface T has a core type if one of the following -conditions is satisfied: -

- -
    -
  1. -There is a single type U which is the underlying type -of all types in the type set of T; or -
  2. -
  3. -the type set of T contains only channel types -with identical element type E, and all directional channels have the same -direction. -
  4. -
- -

-No other interfaces have a core type. -

- -

-The core type of an interface is, depending on the condition that is satisfied, either: -

- -
    -
  1. -the type U; or -
  2. -
  3. -the type chan E if T contains only bidirectional -channels, or the type chan<- E or <-chan E -depending on the direction of the directional channels present. -
  4. -
- -

-By definition, a core type is never a defined type, -type parameter, or -interface type. -

- -

-Examples of interfaces with core types: -

- -
-type Celsius float32
-type Kelvin  float32
-
-interface{ int }                          // int
-interface{ Celsius|Kelvin }               // float32
-interface{ ~chan int }                    // chan int
-interface{ ~chan int|~chan<- int }        // chan<- int
-interface{ ~[]*data; String() string }    // []*data
-
- -

-Examples of interfaces without core types: -

- -
-interface{}                               // no single underlying type
-interface{ Celsius|float64 }              // no single underlying type
-interface{ chan int | chan<- string }     // channels have different element types
-interface{ <-chan int | chan<- int }      // directional channels have different directions
-
- -

-Some operations (slice expressions, -append and copy) -rely on a slightly more loose form of core types which accept byte slices and strings. -Specifically, if there are exactly two types, []byte and string, -which are the underlying types of all types in the type set of interface T, -the core type of T is called bytestring. -

- -

-Examples of interfaces with bytestring core types: -

- -
-interface{ int }                          // int (same as ordinary core type)
-interface{ []byte | string }              // bytestring
-interface{ ~[]byte | myString }           // bytestring
-
- -

-Note that bytestring is not a real type; it cannot be used to declare -variables or compose other types. It exists solely to describe the behavior of some -operations that read from a sequence of bytes, which may be a byte slice or a string. -

-

Type identity

-Two types are either identical or different. +Two types are either identical ("the same") or different.

@@ -3253,7 +3153,8 @@ math.Sin // denotes the Sin function in package math

Composite literals

-Composite literals construct new composite values each time they are evaluated. +Composite literals construct new values for structs, arrays, slices, and maps +each time they are evaluated. 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.

@@ -3271,10 +3172,14 @@ Element = Expression | LiteralValue .

-The LiteralType's core type T +Unless the LiteralType is a type parameter, +its underlying type must be a struct, array, slice, or map type (the syntax enforces this constraint except when the type is given as a TypeName). +If the LiteralType is a type parameter, all types in its type set +must have the same underlying type which must be +a valid composite literal type. The types of the elements and keys must be assignable to the respective field, element, and key types of type T; there is no additional conversion. @@ -3459,7 +3364,6 @@ noteFrequency := map[string]float32{ } -

Function literals

@@ -3932,11 +3836,12 @@ The following rules apply:

-If a is neither a map nor a type parameter: +If a is neither a map nor a type parameter: