Re: [go-nuts] [generics] instantiation of structs within generic functions

2023-06-08 Thread Jim Minter
On Thursday, 8 June 2023 at 22:23:51 UTC-6 Ian Lance Taylor wrote: On Thu, Jun 8, 2023 at 8:59 PM Jim Minter wrote: > > I'm rather confused by instantiation of structs in generic functions. I happen to be using go protobufs. Unlike with `json.Unmarshal`, `proto.Unmarshal` expects to receive a

Re: [go-nuts] [generics] instantiation of structs within generic functions

2023-06-08 Thread Ian Lance Taylor
On Thu, Jun 8, 2023 at 8:59 PM Jim Minter wrote: > > I'm rather confused by instantiation of structs in generic functions. I > happen to be using go protobufs. Unlike with `json.Unmarshal`, > `proto.Unmarshal` expects to receive a fully pre-instantiated struct to > unmarshal into. The non-ge

[go-nuts] [generics] instantiation of structs within generic functions

2023-06-08 Thread Jim Minter
Hi, I'm rather confused by instantiation of structs in generic functions. I happen to be using go protobufs. Unlike with `json.Unmarshal`, `proto.Unmarshal` expects to receive a fully pre-instantiated struct to unmarshal into. The non-generic case looks like this: var _ proto.Message = (*Fo