Re: [go-nuts] [generics] Simplification: Methods refer to original type parameters instead of re-specifying each time

2020-06-17 Thread Ian Lance Taylor
On Wed, Jun 17, 2020 at 5:18 PM Randall O'Reilly wrote: > > Good point! > > I can think of 2 possible (non-mutex) solutions: > > * Use an explicit type expression to refer to the type: `type(ms.T)` and the > field is just `ms.T` > > * Within the method scope, make `T` a valid type name, so you

Re: [go-nuts] [generics] Simplification: Methods refer to original type parameters instead of re-specifying each time

2020-06-17 Thread Randall O'Reilly
Good point! I can think of 2 possible (non-mutex) solutions: * Use an explicit type expression to refer to the type: `type(ms.T)` and the field is just `ms.T` * Within the method scope, make `T` a valid type name, so you can just use `T` directly -- this might even be preferable overall as it

Re: [go-nuts] [generics] Simplification: Methods refer to original type parameters instead of re-specifying each time

2020-06-17 Thread Tyler Compton
I think this syntax could get confusing when embedded fields is added to the mix: type MyStruct(type T) struct { T } func (ms *MyStruct) MyMethod(t ms.T) { ms.T = t } In this example. ms.T means two very different things depending on where they are used. On Wed, Jun 17, 2020 at 3:45