go/doc/next/2-language.md

863 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 [iter] package documentation and the language spec. For motivation see the 2022 "range-over-func" discussion.

Go 1.23 includes preview support for generic type aliases. Building the toolchain with GOEXPERIMENT=aliastypeparams enables this feature.