Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> > Avoid unused method receiver names

> That's just "don't create a non-static method if you don't use 'this'" in other languages with classes.

I don't think that's what's meant. It means to write `func (Receiver) Method()` rather than `func (r Receiver) Method()` when you don't use `r`. Sometimes you need this to implement an interface like `error` or `Stringer` and you just don't need instance data.

(I'm no Go apologist but I think "receiver" is a great term. It's clear, it's applies to other languages and paradigms, and it doesn't really have an alternative that I'm aware of.)



The term “receiver” comes from Smalltalk: http://www.bitsavers.org/pdf/xerox/parc/techReports/SSL-76-6...


That makes sense. I just about figured it would. :-)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: