From ccc42b0f91a7fc44b0353dea3f302f79fb28b300 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Fri, 26 May 2023 14:04:37 -0700
Subject: [PATCH] doc/go1.21: document clear builtin and init order changes
Also move all the language changes to the same part of the release notes.
For #56351
For #57411
Change-Id: Id1c51b5eb8f7d85e61a2ae44ee7d73bb13036631
Reviewed-on: https://go-review.googlesource.com/c/go/+/498755
TryBot-Bypass: Ian Lance Taylor
Reviewed-by: Ian Lance Taylor
Reviewed-by: Keith Randall
Auto-Submit: Ian Lance Taylor
Reviewed-by: Dmitri Shuralyov
Auto-Submit: Ian Lance Taylor
---
doc/go1.21.html | 68 +++++++++++++++++++++++++++++++++----------------
1 file changed, 46 insertions(+), 22 deletions(-)
diff --git a/doc/go1.21.html b/doc/go1.21.html
index 3758d282c3..075cee592a 100644
--- a/doc/go1.21.html
+++ b/doc/go1.21.html
@@ -25,13 +25,53 @@ Do not send CLs removing the interior tags from such phrases.
Changes to the language
-
- Go 1.21 adds two new built-ins to the language:
- the new functions min
and max
compute the
- smallest (or largest, for max
) value of a fixed number
- of given arguments.
- See the language spec for details.
+ Go 1.21 adds three new built-ins to the language.
+
+
+ -
+ The new functions
min
and max
compute the
+ smallest (or largest, for max
) value of a fixed number
+ of given arguments.
+ See the language spec for
+ details.
+
+ -
+ The new function
clear
deletes all elements from a
+ map or zeroes all elements of a slice.
+ See the language spec for
+ details.
+
+
+
+
+
+ Package initialization order is now specified more precisely. The
+ new algorithm is:
+
+ -
+ Sort all packages by import path.
+
+ - Repeat until the list of packages is empty:
+
+ -
+ Find the first package in the list for which all imports are
+ already initialized.
+
+ -
+ Initialize that package and remove it from the list.
+
+
+
+
+ This may change the behavior of some programs that rely on a
+ specific initialization ordering that was not expressed by explicit
+ imports. The behavior of such programs was not well defined by the
+ spec in past releases. The new rule provides an unambiguous definition.
+
+
+
+ TODO: https://go.dev/issue/59338: infer type arguments from assignments of generic functions (reverse type inference)
@@ -745,22 +785,6 @@ Do not send CLs removing the interior tags from such phrases.
-
- spec
- -
-
- TODO: https://go.dev/issue/56351: add clear(x) builtin, to clear map, zero content of slice
-
-
-
- TODO: https://go.dev/issue/57411: define initialization order more precisely
-
-
-
- TODO: https://go.dev/issue/59338: infer type arguments from assignments of generic functions (reverse type inference)
-
-
-
-
- sync
-
--
2.50.0