A some weak reason not to support the change. Using unnamed parameter types could avoiding some explicit conversions.
package main import "net/http" type MyHandlerFunc func(http.ResponseWriter, *http.Request) func f(http.HandlerFunc) {} func g(MyHandlerFunc) {} func h(func(http.ResponseWriter, *http.Request)) {} func main() { var x http.HandlerFunc var y MyHandlerFunc var z func(http.ResponseWriter, *http.Request) f(x) // ok f(y) // error: need conversion f(z) // ok g(x) // error: need conversion g(y) // ok g(z) // ok h(x) // ok h(y) // ok h(z) // ok } On Sunday, June 27, 2021 at 9:52:39 AM UTC-4 vituc...@gmail.com wrote: > Hello gophers! > > While studing at this source code > <https://github.com/golang/go/blob/37f9a8f69d6299783eac8848d87e27eb563500ac/src/net/http/server.go> > > in search for some knowledge and enlightment, i do note that in some file a > type is defined and then is not used in a place where it could be used. > This open an interrogant for me, because tipification is often good thing, > regardless the language I may state, and I express it via a ticket > <https://github.com/golang/go/issues/46926>. I get the idea that due to > language grammar changing the code would be a breaking change. > > But i keep wondering if they actually do this for a reason.. i mean, given > the possiblity to get back in time, ¿does the team at golang will write the > same source code, definiting a type with a name and then intenttionally not > using it? i mean...i keep wondering if there is any reason for defined > types and then not use it and using the gitlab channel i probably fail to > express my initial intention. I do often read some third party code, in > order to view others minds (or try at least..), what i'm asking here is a > question in order to get another people point of view. > > Thanks again! > > -- 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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7e711368-6d9c-4a47-ad2a-679a652c04b3n%40googlegroups.com.