On Sat, Jul 16, 2016 at 10:39 AM T L <tapir....@gmail.com> wrote: > I know this result, but I just need the reason, not the result.
The method set distinction of T vs *T allows to forbid calling methods intended to mutate the receiver (ie. receiver is *T) on the wrong receiver type (T). The later case would mutate the value (not the value that should be pointed to) stored _in_ the interface, not the value at the caller's site. Declaring the method receiver as *T forces callers to use the properly typed thing (*T instead T) they pass via interfaces as the compiler will reject the incorrect case. -- -j -- 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.