From 1b07b774c06ba0a0baf0a19324ab76ace5741305 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 4 Jun 2024 16:06:12 -0700 Subject: [PATCH] doc: document "range-over-func" language change in release notes For #65614. Change-Id: Idbbcb6eb57b7294d52b174c1aba74ca7aa1b8efd Reviewed-on: https://go-review.googlesource.com/c/go/+/590616 Reviewed-by: Ian Lance Taylor Reviewed-by: Robert Griesemer TryBot-Bypass: Robert Griesemer --- doc/next/2-language.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/next/2-language.md b/doc/next/2-language.md index 61030bd676..e45874b954 100644 --- a/doc/next/2-language.md +++ b/doc/next/2-language.md @@ -1,3 +1,13 @@ ## Changes to the language {#language} + +Go 1.23 makes the (Go 1.22) ["range-over-func" experiment](https://tip.golang.org/wiki/RangefuncExperiment) a part of the language. +The "range" clause in a "for-range" loop now accepts iterator functions of the following types + func(func() bool) + func(func(K) bool) + func(func(K, V) bool) + + as range expressions. + Calls of the iterator argument function produce the iteration values for the "for-range" loop. + For details see the [language spec](https://tip.golang.org/ref/spec#For_statements). -- 2.48.1