Background: I'm currently working on making the Gomega matcher library <https://github.com/onsi/gomega> iterator-aware as first-class citizens. That is, matchers working on "collection" types such as slice and map will then accept iterator functions and act accordingly. As I also work on updating the matcher documentation I'm struggling with terminology/wording. Please keep in mind that the matcher documentation needs to be sweet and short, as there are repetitive mentioning of iterator handling appearing in multiple places.
To use a concrete example, BeEmpty() <https://github.com/onsi/gomega> currently pre-iterator is described as follows: [...]* succeeds if *ACTUAL is, in fact, empty. ACTUAL must be of type string , array, map, chan, or slice. It is an error for it to have any other type. Here, I want now to add that *ACTUAL* additionally can be an iterator in a hopefully concise, yet compact way. Please note that we don't want to support any range-able value here, just iterators. Now, does the term "*iterator*" always refer to a function, and in particular, to "*a function that passes successive elements of a sequence to a callback function*"? [package iter, section Iterators <https://pkg.go.dev/iter#hdr-Iterators>] How can I guide devs new to Go's iterator pattern to quickly grasp that *ACTUAL* can be a function that is "assignable to" (i.e., "AssignableTo" in reflect speak) iter.Seq and/or iter.Seq2 . Is the following phrasing (bold to emphasize the new part) acceptable? Can this be improved (without singing an opera)? [...]* succeeds if *ACTUAL is, in fact, empty. ACTUAL must be of type string , array, map, chan, or slice. *Starting with Go 1.23,** ACTUAL can be also an iterator function with an iter.Seq or iter.Seq2-like signature** .* It is an error for it to have any other type. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/d736f3a4-6a3d-4925-9f42-3e4189393cc1n%40googlegroups.com.