On Wed, 28 Mar 2018, at 5:21 PM, thwd wrote:
> https://play.golang.org/p/pjyoPX99Zr1
> 
> Taking the address of an explicit dereference has different behavior
> than implicitly dereferencing and taking address.> 
> Is this the desired behavior? It surprised me.

I think the naming of your functions is misleading you. In the
following code,CopyImplicitDeref is called on the pointer called a
since the method set of the pointer type includes all the methods of
the value type.
a := &T{0}
b := a.CopyImplicitDeref()

There is no copying in this case.

Ian

-- 
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.

Reply via email to