[go-nuts] Re: Why not a mixture of value and pointer receiver?

2019-01-22 Thread T L
https://groups.google.com/forum/#!topic/golang-nuts/gJtXQhpoA4U

On Tuesday, January 22, 2019 at 5:59:51 PM UTC-4, Xinhu Liu wrote:
>
> In "A Tour of Go " I read: 
>
> In general, all methods on a given type should have either value or 
>> pointer receivers, but not a mixture of both.
>
>
> But why not?
>
> Methods having value receiver can be called by both value type and pointer 
> type. The same is for methods having pointer receiver.
>
> What is disadvantages of mixing value and pointer receiver?
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Why not a mixture of value and pointer receiver?

2019-01-22 Thread 伊藤和也
Yes I agree with you. It's confusing and so hard to understand.

2019年1月23日水曜日 6時59分51秒 UTC+9 Xinhu Liu:
>
> In "A Tour of Go " I read: 
>
> In general, all methods on a given type should have either value or 
>> pointer receivers, but not a mixture of both.
>
>
> But why not?
>
> Methods having value receiver can be called by both value type and pointer 
> type. The same is for methods having pointer receiver.
>
> What is disadvantages of mixing value and pointer receiver?
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.