Thanks to all for sharing with me insight.
My assessment of the situation until now is:

   - Changing things indded would be a pain as there is to much build on 
   top of it due to grammar.
   - If i could back in time i would write this function signature 
   
<https://github.com/golang/go/blob/37f9a8f69d6299783eac8848d87e27eb563500ac/src/net/http/server.go#L2473>
 using 
   this named type 
   
<https://github.com/golang/go/blob/37f9a8f69d6299783eac8848d87e27eb563500ac/src/net/http/server.go#L2042>
 for 
   the second argument. I see no harm on doing it that way.

Greetings


El domingo, 27 de junio de 2021 a las 23:10:29 UTC-3, tapi...@gmail.com 
escribió:

> 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/05ab47f8-2dd7-4222-9b7a-b624e992e4cfn%40googlegroups.com.

Reply via email to