From: Russ Cox Date: Tue, 22 Nov 2022 14:24:24 +0000 (-0500) Subject: doc/go1.20: document spec changes X-Git-Tag: go1.20rc1~95 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a16f4175b5ed1135279b29897e4d1d327476ec88;p=gostls13.git doc/go1.20: document spec changes Change-Id: I2e35bddfe20c96a8dc0ab187286aaf543ff66164 Reviewed-on: https://go-review.googlesource.com/c/go/+/452758 Reviewed-by: Robert Griesemer Reviewed-by: Matthew Dempsky Run-TryBot: Russ Cox TryBot-Result: Gopher Robot --- diff --git a/doc/go1.20.html b/doc/go1.20.html index 5fadb3e3aa..fa712696ff 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -26,15 +26,34 @@ Do not send CLs removing the interior tags from such phrases.

Changes to the language

- TODO: complete this section + Go 1.20 includes three changes to the language.

-

- TODO: https://go.dev/issue/8606: define that structs are compared field-by-field as listed in source code +

+ Go 1.17 added conversions from slice to an array pointer. + Go 1.20 extends this to allow conversions from a slice to an array: + given a slice x, [4]byte(x) can now be written + instead of *(*[4]byte)(x).

-

- TODO: https://go.dev/issue/46505: allow conversion from slice to array +

+ The unsafe package defines + three new functions SliceData, String, and StringData. + Along with Go 1.17's Slice, these functions now provide the complete ability to + construct and deconstruct slice and string values, without depending on their exact representation. +

+ +

+ The specification now defines that struct values are compared one field at a time, + considering fields in the order they appear in the struct type definition, + and stopping at the first mismatch. + The specification could previously have been read as if + all fields needed to be compared beyond the first mismatch. + Similarly, the specification now defines that array values are compared + one element at a time, in increasing index order. + In both cases, the difference affects whether certain comparisons must panic. + Existing programs are unchanged: the new spec wording describes + what the implementations have always done.

Ports