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

Because I want to know what function does?



Assuming Car() is a receiver function, you should be able to infer "how" the Car is "fetched" based on the type receiving the function call.

func (d CarDB) func Car() (Car, error)

The above tells you everything you need to know. As for usage, again, the type and now also the variable names should let you infer everything you need.

func f(db *CarDB) { c, _ := db.Car() }

The function name makes as little of a guarantee as to the underlying "how" as these other factors.


I think it's not possible to achieve with func name on its own, the closest thing I see would be comments on the function but again not reliable imo.


Absolutely not reliable. Comments get stale faster than anything else in the codebase.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: