On Thu, Jun 21, 2012 at 2:17 PM, Aaron France
<
a.france.m...@gmail.com> wrote:
> The method receiver argument should say something about the method that's
> receiving it. So something like self, this or similar go to great lengths to
> show that the object being used is the object which the method is tied to.
> Whereas function arguments are objects defined only in the scope of that
> function, thus mean something only in the scope of that function and
> therefore should have names which coincide with what they are/are doing.
I think you're overthinking the role of the method receiver.
> This is a real nitpicky thing to point out but as a Go learner I can lose
> track easily of the name of the method since each method function usually
> has something completely different. I vote for "self".
>
> I understand that it's syntactic sugar. However, would people kill me if I
> just used "self" in all my method functions?
It's fine if you also name your method arguments "arg0", "arg1", "arg2", etc.
Note this: the method callers never name the receiver; they name the
variable (or expression) they have. So the name of the method receiver
only matters to the code of the method. Given that, "self" is not a
useful name, especially if you end up passing that variable on to
something else that might be a method on a different type, or a
standalone function.
Dave.