Using D syntax:
func (r MyType) foo(A, B)(x A, y B) (z B, err error) {
...
}
result, _ := MyType.foo!(int, int)(10, 20)
Also, there's no reason why A and B can't be inferred:
result, _ := MyType.foo(10, 20)
It looks alright to me and very useful!
On Thursday, 24 August 2017 16:14:58 UTC+1, JuciĆ Andrade wrote:
>
> A lot of people like Go because code is very readable even for beginners.
>
> func f(x, y int)
>
> f is a function that receives x and y as int parameters, returning
> nothing. Simple enough.
>
> func f(x, y int) int
>
> f is a function that receives x and y as int parameters, returning yet
> another int. Fine.
>
> func f(x, y int) (z int, err error)
>
> f is a function that receives x and y as int parameters, returning two
> values: a first int, that we name z and an error named err. A little bit
> weird, but ok.
>
> func (r MyType) f(x, y int) (z int, err error)
>
> f is a method for a value of type MyType, henceforth named r, that
> receives x and y as int parameters, returning two values: a first int, that
> we name z and an error named err. Definitely not so simple.
>
> <genType1, genType2> func (r genType1) f(x, y genType2) (z getType2, err
> error)
>
> You must be kidding. STOP RIGHT THERE!
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.