mirror of
https://github.com/golang/go
synced 2024-11-14 23:20:27 -07:00
e53d10dc04
The language change for the accepted range-over-func proposal #61405 was documented in CL 590616. Remove the corresponding 'TODO' entry. Also improve formatting slightly, and switch to preferred relative links. They'll work better in the long term and in more contexts. While here, also simplify the suggested line to preview release notes locally: setting the -content='' flag explicitly is no longer required as of CL 589936. For #65614. Change-Id: I6cee951b9ede33900bca48c9f709e3b2c5e87337 Reviewed-on: https://go-review.googlesource.com/c/go/+/590756 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
757 B
757 B
Changes to the language
Go 1.23 makes the (Go 1.22) "range-over-func" experiment 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.
Go 1.23 includes preview support for generic type aliases.
Building the toolchain with GOEXPERIMENT=aliastypeparams
enables this feature.