[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

[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