[go-nuts] [generics] Closure?

2020-06-18 Thread teivah . dev
Hello, I didn't find in the latest draft design any mention of generics with closure and I'm struggling in having something working: type Foo(type T) struct {} func bar(type T)() Foo(T) { return func() Foo(T) { return Foo(T){} }() } In this example, how can I create a closure that

Re: [go-nuts] [generics] A Channel of a Generic Structure

2020-06-18 Thread teivah
Cool, it does work, thanks! Btw, thank you guys for your work. I know there are a lot of discussions going on but personally I'm very happy with generics so far. I'll keep working on my migration. On Thursday, 18 June 2020 00:39:02 UTC+2, Ian Lance Taylor wrote: > > On Wed, Jun 17, 2020 at 2:37

[go-nuts] [generics] A Channel of a Generic Structure

2020-06-17 Thread teivah . dev
Hello all, I'm working on implementing generics on a big container projet. So far, everything was good except for this very case: type Foo(type T) struct { v int } func (_ *Foo(T)) bar() int { elem := <-make(chan Foo(T)) return elem.v } *Foo* being a generic structure, I have a method