GoイテレータにおけるPush/Pullの違い
This content is a draft and will not be included in production builds.
GoのイテレータはPush型またはPull型どちらかによって、ビルドされるバイナリの挙動が変わる。
cmd/compile/internal/rangefuncのドキュメントにあるように、
var f iter.Seq[T]for x := range f { ...}このコード片は以下のように展開される。
f(func(x T) bool { ...})読んでいないけど、特殊なゴルーチンが起動して待機するらしい。