On Tue, 2021-08-10 at 14:50 -0700, E Z wrote:
> It works when I changed the code as your suggested. That's great,
> thanks.
>
> And I'm still a little confused here, you know when we use the struct
> method directly, it is only when the function is called that the type
> of receiver determines whether the passed struct is a pointer or a
> copied value. But when using a function pointer, why does it decide
> whether to bind a pointer or a copied value at the time of
> assignment, but not at the time of function called?
>
> It seems that these two behaviors are not consistent. Is there any
> benefit to doing so? I didn't find much information on this topic on
> Google. Is there any extended reading on this topic?
>

When you do this, `pf := gz.Display', you are capturing the state of gz
as it is. This fixes the animal.

Dan


-- 
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/a5b5ba862f417f144182f0462e13c867532d9a32.camel%40kortschak.io.

Reply via email to