I don't really understand the question. What I'm saying is
1. we don't want them to be defined types, because of the issue I
described, so
2. it probably needs to be possible to have generic type aliases first and
3. once that is possible, we might add `Yield` and `Yield2` as type-aliases
to the `iter` package.
And if that happens, then yes, you could use them, of course.

On Thu, 22 Aug 2024 at 11:03, lijh8 <li...@qq.com> wrote:

> Hi,
>
> Do you mean that if the new Yield types are in the iter package,
> it can be used after that?
>
> ```
>
> type Yield[V any] func(V) bool
> type Yield2[K comparable, V any] func(K, V) bool
> type Seq[E any] func(Yield[E])
> type Seq2[K comparable, V any] func(Yield2[K, V])
>
> // not importing iter, so can't use the named types
> func All2[E any](s []E) func(func(E) bool) {
> return func(yield func(E) bool) {
> for _, v := range s {
> if !yield(v) {
> return
> }
> }
> }
> }
>
> func All2_b[E any](s []E) Seq[E] {
> return func(yield Yield[E]) {
> for _, v := range s {
> if !yield(v) {
> return
> }
> }
> }
> }
>
> ```
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHG922qLJd%3DaSrYFvhQML4uqyp-R6fFVJPp7YWQLQUV2A%40mail.gmail.com.

Reply via email to