Re: [go-nuts] Language idea: Improved support for method-like functions

2022-12-20 Thread Red Daly
On Mon, Dec 19, 2022 at 12:25 PM Axel Wagner wrote: > > > On Mon, Dec 19, 2022 at 8:31 PM Red Daly wrote: > >> Methods cannot take type arguments, so I find myself writing `func Foo(o >> Object) {...}` instead of `func (o Object) Foo()` in cases where Foo needs >

[go-nuts] Language idea: Improved support for method-like functions

2022-12-19 Thread Red Daly
Methods cannot take type arguments, so I find myself writing `func Foo(o Object) {...}` instead of `func (o Object) Foo()` in cases where Foo needs a type parameter. I would like some type of pseudo-method in Go similar to Kotlin's extension methods. Made up syntax: ```go package foo func (o

Re: [go-nuts] Generics and parentheses

2020-08-06 Thread 'Red Daly' via golang-nuts
Have the authors considered the implications of requiring the `type` keyword to use a generic type, not just at declaration time? Would this open up more syntax possibilities, such as `var x T`? This might be easier to read at the expense of five more characters of typing. It also could