Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-06 Thread gtownsend
Please go ahead, Tim. I’m not really worried about credit for one sentence. You can mention me in the comments if you’d like. Gregg On Tuesday, February 6, 2018 at 1:11:10 AM UTC-7, thec...@netflix.com wrote: > > Hey Gregg > > I think that would make it more clear and looks great. I wouldn't w

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-06 Thread theckman via golang-nuts
Hey Gregg I think that would make it more clear and looks great. I wouldn't want to take credit for your copy, but I'd be happy to open an issue / PR with this change. I'm not sure how to best attribute it to you. Cheers! -Tim On Monday, February 5, 2018 at 2:35:47 PM UTC-8, Gregg Townsend wro

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread gtownsend
You're right. I do think expanding the section on method sets is worthwhile because that section *seems* to have the complete set of rules. But any addition needs to be clear, concise *and* correct. How about: ... Additionally, an addressable v

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread 'Axel Wagner' via golang-nuts
That sentence wouldn't be true, though. There is a call-expression shorthand, but the method does not actually get added to T - so, for example var b bytes.Buffer b.WriteString("foo") // fine (&b).WriteString("foo") // the same, as it's just syntactic sugare r := strings.NewReader("foo") io.Copy(b

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread gtownsend
This issue once puzzled me, too. It would help to add something to the spec section on method sets . I suggest something like this at the very end of the second paragraph: ... Additionally, if a receiver of type T is *addressable

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread theckman via golang-nuts
Yep, this is exactly it. I missed this section when I was trying to figure this out. Thank you! -Tim On Monday, February 5, 2018 at 11:53:32 AM UTC-8, Paul Jolly wrote: > > Hi Tim, > > Take a look at https://golang.org/ref/spec#Calls: > > "A method call x.m() is valid if the method set of (the

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread Burak Serdar
On Mon, Feb 5, 2018 at 10:42 AM, theckman via golang-nuts wrote: > Hey Gophers, > > I've run in to an interesting case regarding Method Sets that makes me > wonder whether it should be disallowed by the spec[1]. Before opening an > issue on GitHub I thought I'd reach out here to get some clarifica

Re: [go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread Paul Jolly
Hi Tim, Take a look at https://golang.org/ref/spec#Calls: "A method call x.m() is valid if the method set of (the type of) x contains m and the argument list can be assigned to the parameter list of m. If x is addressable and &x's method set contains m, x.m() is shorthand for (&x).m()" Paul On

[go-nuts] Question about the spec: Method Sets and Pointer Receivers

2018-02-05 Thread theckman via golang-nuts
Hey Gophers, I've run in to an interesting case regarding Method Sets that makes me wonder whether it should be disallowed by the spec[1]. Before opening an issue on GitHub I thought I'd reach out here to get some clarifications as I may be misreading the spec. Based on my understanding of met