In your implementation, p type is no longer generic.

Manlio

On Thursday, January 27, 2022 at 6:29:25 PM UTC+1 clemento...@gmail.com 
wrote:

> Hello
> Check this
>
> https://gotipplay.golang.org/p/d7nq2OV82Nv
>
>
> On Thursday, January 27, 2022 at 12:12:50 PM UTC+1 manlio....@gmail.com 
> wrote:
>
>> On Thursday, January 27, 2022 at 11:42:19 AM UTC+1 Manlio Perillo wrote:
>>
>>> Consider this example, adapted from 
>>> https://github.com/golang/proposal/blob/master/design/43651-type-parameters.md#composite-types-in-constraints
>>>  
>>> (note that the example is incorrect):
>>> https://gotipplay.golang.org/p/a8fHVTUpeie
>>>
>>> The compiler reports an error:
>>> ./prog.go:14:9: p.x undefined (type *T is pointer to type parameter, not 
>>> type parameter) ./prog.go:16:4: p.x undefined (type *T is pointer to type 
>>> parameter, not type parameter)
>>>
>>> What is the reason why the code does not compile?
>>>
>>>
>> Here is an alternate implementation:
>> https://gotipplay.golang.org/p/mGm8DkqkuAX
>>
>> The code **seems** reasonable, but the compiler reports an error:
>> ./prog.go:24:12: *MyStruct does not implement structField
>>
>> Thanks
>>  Manlio
>>
>

-- 
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/f0cd1518-394d-4ac6-9314-8942f73ab3c5n%40googlegroups.com.

Reply via email to