Hacker News new | past | comments | ask | show | jobs | submit login

> "receiver implict this parameter"

The parameter is actually quite explicit (unlike some other languages).

It would probably help your write up to talk about the difference between (using your example):

  func (r Rectangle) Area() float64 {
and

  func Area(r Rectangle) float64 {
As well as (this is a common rookie mistake):

  func (r Rectangle) SetWidth(w float64) {
    r.Width = w // does nothing
and

  func (r *Rectangle) SetWidth(w float64) {
    r.Width = w



You might want to point to point that (if?) the second example does work? (And that the difference is the *)




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: