Re: [go-nuts] Surprise About How Method Receivers Work

2017-12-18 Thread matthewjuran
Well you're talking about method receivers, not struct fields. It's a similar shortcut, but sorry about going off topic with the example. Matt On Monday, December 18, 2017 at 5:05:19 PM UTC-6, matthe...@gmail.com wrote: > > Here's a specific example of how this works for me. I have a chess board

Re: [go-nuts] Surprise About How Method Receivers Work

2017-12-18 Thread matthewjuran
Here's a specific example of how this works for me. I have a chess board represented as a 64 element array of points: type Point struct { *Piece // nil for no piece AbsPoint } // Absolute Point represents a specific point on the board. type AbsPoint struct { File uint8 Rank uint8 } type Piece

Re: [go-nuts] Surprise About How Method Receivers Work

2017-12-18 Thread jlforrest
On Monday, December 18, 2017 at 12:12:22 PM UTC-8, Dave Cheney wrote: > > It's true it is an exception, it's one of the few cases where the language > adds a pinch of syntactic sugar to make the experience more pleasurable. > I'd describe this more as removing a pinch of syntactic sugar. I ca

Re: [go-nuts] Surprise About How Method Receivers Work

2017-12-18 Thread Dave Cheney
It's true it is an exception, it's one of the few cases where the language adds a pinch of syntactic sugar to make the experience more pleasurable. I can imagine without this the number one oft repeated feature request would be to _not_ have to write (&t).m() all the time when you just wanted t

Re: [go-nuts] Surprise About How Method Receivers Work

2017-12-18 Thread Marvin Renich
* jlforr...@berkeley.edu [171217 15:33]: > Here's what I believe is the explanation. The book says (slightly > edited) "If the receiver p is a variable of type Path but the method > requires a *Path receiver, we can use this shorthand: > > p.pr1() > > and the compiler will perform an implicit &p