mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
For #65614. Change-Id: I05b20a80b1163e1d3927c2f763ef6b7d20e6a937 Reviewed-on: https://go-review.googlesource.com/c/go/+/590617 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
17 lines
825 B
Markdown
17 lines
825 B
Markdown
## Changes to the language {#language}
|
|
|
|
<!-- go.dev/issue/61405, CL 557835, CL 584596 -->
|
|
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).
|
|
|
|
<!-- go.dev/issue/46477, CL 566856, CL 586955, CL 586956 -->
|
|
Go 1.23 includes preview support for [generic type aliases](/issue/46477).
|
|
Building the toolchain with `GOEXPERIMENT=aliastypeparams` enables this feature.
|