Re: [go-nuts] Go generics and bloating

2022-08-17 Thread 'Axel Wagner' via golang-nuts
On Wed, Aug 17, 2022 at 11:17 AM Brian Candler wrote: > So when I write > > func (e Plus[Evaler]) Eval() int { > > IIUC, it is effectively treated as if it were the following (not currently > valid syntax): > > func (e Plus[Evaler any]) Eval() int { > > - i.e. inside this function "Evaler

Re: [go-nuts] Go generics and bloating

2022-08-17 Thread Andrew Harris
This particular example might be hiding some benefits of having the type parameter in the method signature. The type parameter can be useful in something like: func (lhs BinaryPlusOp[T]) Eval( rhs T) T Or, for being explicit about why func (t Number[T]) Sum( []T ) T can't accept a slice of v

Re: [go-nuts] Go generics and bloating

2022-08-17 Thread Brian Candler
So when I write func (e Plus[Evaler]) Eval() int { IIUC, it is effectively treated as if it were the following (not currently valid syntax): func (e Plus[Evaler any]) Eval() int { - i.e. inside this function "Evaler" is a local type parameter whose name just happens to shadow the out

Re: [go-nuts] Go generics and bloating

2022-08-17 Thread 'Axel Wagner' via golang-nuts
On Wed, Aug 17, 2022 at 10:43 AM Brian Candler wrote: > That's an interesting paper - at least the early parts that I could > understand! > > I tried converting their main > motivating example from fig 8, but got stuck by not being able to put a > method on a p

Re: [go-nuts] Go generics and bloating

2022-08-17 Thread Brian Candler
On Tuesday, 16 August 2022 at 21:15:03 UTC+1 axel.wa...@googlemail.com wrote: > You are looking for "Featherweight Go", I believe. > https://arxiv.org/abs/2005.11710 > That's an interesting paper - at least the early parts that I could understand! I tried converting

Re: [go-nuts] Go generics and bloating

2022-08-16 Thread 'Axel Wagner' via golang-nuts
You are looking for "Featherweight Go", I believe. https://arxiv.org/abs/2005.11710 On Tue, Aug 16, 2022 at 10:03 PM Guillaume Lescure wrote: > Hello, > > I remember a paper about Go Generics but I cannot find it again. > It was a scientist paper (with a lot of maths far beyond my understanding

[go-nuts] Go generics and bloating

2022-08-16 Thread Guillaume Lescure
Hello, I remember a paper about Go Generics but I cannot find it again. It was a scientist paper (with a lot of maths far beyond my understanding ^^). Title was something like "Lightweigh generics for Go" or something like that. I believe the background of the website was red (not sure either).