Hi,
After looking at the latest proposal -
https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md,
and also checked a curated list of discussion at -
https://groups.google.com/forum/#!msg/golang-nuts/uQDrcHDwT_w/Y-Myzuw_AQAJ.
However, I do find myself still interested in a case like below:
type foo struct{}
func bar(x int) func(int) int {
return func(y int) int {
return x + y
}
}
func main() {
foo := 1
result := bar(foo)(2)
fmt.Println(result)
}
I believe a function which returns another function in current Go world is
pretty normal. I specifically mocked an example above - where the first
parameter name appears to collide with a type name.
With that said, I guess compiler won't have any issues to figure it out
when it is type parameter and when it is not. However, I think that's not
trivial for a human, though.
So is this a problem or I may just have ignored anything?
Thanks,
Haibing
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/16b683af-b8cc-4e5f-b1b2-1c05da7e0c56o%40googlegroups.com.