Re: [go-nuts] Contracts Draft: why are method pointers allowed

2019-07-30 Thread Ilia Choly
This completely answers my question. On Monday, July 29, 2019 at 8:49:31 PM UTC-4, Steven Blenkinsop wrote: > > On Mon, Jul 29, 2019 at 2:25 PM, Ian Lance Taylor > wrote: > >> The motivation is to avoid requiring contracts to specify whether >> a method is a pointer method or a value method,

Re: [go-nuts] Contracts Draft: why are method pointers allowed

2019-07-29 Thread Steven Blenkinsop
On Mon, Jul 29, 2019 at 2:25 PM, Ian Lance Taylor wrote: > The motivation is to avoid requiring contracts to specify whether a method > is a pointer method or a value method, just as we do not require interface > types to specify whether a method is a pointer method or a value method. > I'm not

Re: [go-nuts] Contracts Draft: why are method pointers allowed

2019-07-29 Thread Ian Lance Taylor
On Mon, Jul 29, 2019 at 7:05 AM Ilia Choly wrote: > > When converting a non-pointer value to an interface, pointer methods cannot > be used to satisfy the interface. Even though the compiler could add > instructions to take the value's address, this is not allowed because it's > error prone.

[go-nuts] Contracts Draft: why are method pointers allowed

2019-07-29 Thread Ilia Choly
When converting a non-pointer value to an interface, pointer methods cannot be used to satisfy the interface. Even though the compiler could add instructions to take the value's address, this is not allowed because it's error prone. Since pointer methods usually mutate the receiver, you don't