Skip to content

Commit

Permalink
doc/go1.21: mention changes to the reflect package
Browse files Browse the repository at this point in the history
Added Value.Clear, deprecated SliceHeader and StringHeader.

For #55002
For #56906

Change-Id: Ib7497aff830d56fad90c31ec28596e71a448e9ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/498757
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
ianlancetaylor authored and gopherbot committed May 26, 2023
1 parent dcb27e8 commit c2bb350
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions doc/go1.21.html
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,21 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
</p>

<p><!-- https://go.dev/issue/55002 -->
TODO: <a href="https://go.dev/issue/55002">https://go.dev/issue/55002</a>: add Value.Clear
</p>

<p><!-- https://go.dev/issue/56906 -->
TODO: <a href="https://go.dev/issue/56906">https://go.dev/issue/56906</a>: deprecate SliceHeader and StringHeader
</p>

<p><!-- CL 452762 -->
TODO: <a href="https://go.dev/cl/452762">https://go.dev/cl/452762</a>: reflect: deprecate SliceHeader and StringHeader; modified api/next/56906.txt
The new <a href="/pkg/reflect/#Value"><code>Value</code></a>
method <a href="/pkg/reflect/#Value.Clear"><code>Value.Clear</code></a>
clears the contents of a map or zeros the contents of a slice.
This corresponds to the new <code>clear</code> built-in
<a href="#language">added to the language</a>.
</p>

<p><!-- https://go.dev/issue/56906, CL 452762 -->
The <a href="/pkg/reflect/#SliceHeader"><code>SliceHeader</code></a>
and <a href="/pkg/reflect/#StringHeader"><code>StringHeader</code></a>
types are now deprecated. In new code
prefer <a href="/pkg/unsafe/#Slice"><code>unsafe.Slice</code></a>,
<a href="/pkg/unsafe/#SliceData"><code>unsafe.SliceData</code></a>,
<a href="/pkg/unsafe/#String"><code>unsafe.String</code></a>,
or <a href="/pkg/unsafe/#StringData"><code>unsafe.StringData</code></a>.
</p>
</dd>
</dl><!-- reflect -->
Expand Down

0 comments on commit c2bb350

Please sign in to comment.