Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Marcus Manning
On 1/14/21 7:59 PM, Ian Lance Taylor wrote: On Thu, Jan 14, 2021 at 4:33 AM Marcus Manning wrote: Hmm..., then we should appreciate the alternative to generate a hidden instance parameter for each instantiated type in the function body. The hidden parameters might need to be up-propagated

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Marcus Manning
On 1/14/21 1:49 PM, roger peppe wrote: This code seems corrupted (no newlines) and incomplete. It's hard to understand what your question is about without seeing the motivational code. I hate mailing lists for exactly this reason. Here is the code again: ``` package p1 // S is a type with

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-14 Thread Marcus Manning
On 1/13/21 11:37 PM, Ian Lance Taylor wrote: On Wed, Jan 13, 2021 at 12:39 PM Marcus Manning wrote: Does reflection support generic instantiation? No. In the current proposal, generic functions and types are not visible at run time. Only instantiated functions and types are visible. So

[go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-13 Thread Marcus Manning
Regarding the the section of No parameterized methods in go generics draft: package p1 // S is a type with a parameterized method Identity. type S struct{} // Identity is a simple identity method that works for any type. func (S) Identity[T any](v T) T { return v } package p2 // HasIdentity is