diff --git a/doc/go_spec.html b/doc/go_spec.html index 4ed5f4d175..87ee7459ff 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -839,7 +839,7 @@ multi-dimensional types.
-A slice is a descriptor for a contiguous segment of an array and
+A slice is a descriptor for a contiguous segment of an underlying array and
provides access to a numbered sequence of elements from that array.
A slice type denotes the set of all slices of arrays of its element type.
The value of an uninitialized slice is nil
.
@@ -879,17 +879,9 @@ A new, initialized slice value for a given element type T
is
made using the built-in function
make
,
which takes a slice type
-and parameters specifying the length and optionally the capacity:
-
-make([]T, length) -make([]T, length, capacity) -- -
-A call to make
allocates a new, hidden array to which the returned
-slice value refers. That is, executing
+and parameters specifying the length and optionally the capacity.
+A slice created with make
always allocates a new, hidden array
+to which the returned slice value refers. That is, executing
@@ -897,8 +889,8 @@ make([]T, length, capacity)
-produces the same slice as allocating an array and slicing it, so these two examples -result in the same slice: +produces the same slice as allocating an array and slicing +it, so these two expressions are equivalent:
@@ -910,8 +902,8 @@ new([100]int)[0:50] Like arrays, slices are always one-dimensional but may be composed to construct higher-dimensional objects. With arrays of arrays, the inner arrays are, by construction, always the same length; -however with slices of slices (or arrays of slices), the lengths may vary dynamically. -Moreover, the inner slices must be allocated individually (withmake
). +however with slices of slices (or arrays of slices), the inner lengths may vary dynamically. +Moreover, the inner slices must be initialized individually.Struct types
@@ -2707,7 +2699,8 @@ and the result of the slice operation is a slice with the same element type as tIf the sliced operand of a valid slice expression is a
nil
slice, the result -is anil
slice. +is anil
slice. Otherwise, the result shares its underlying array with the +operand.Full slice expressions
@@ -5361,9 +5354,9 @@ append(s S, x ...T) S // T is the element type of SIf the capacity of
s
is not large enough to fit the additional -values,append
allocates a new, sufficiently large slice that fits -both the existing slice elements and the additional values. Thus, the returned -slice may refer to a different underlying array. +values,append
allocates a new, sufficiently large underlying +array that fits both the existing slice elements and the additional values. +Otherwise,append
re-uses the underlying array.