Hacker News new | ask | show | jobs
by teeray 1099 days ago
It’s the complete lack of magic. What you see in front of you is pretty much exactly what happens. You don’t have to keep a cathedral of language semantic subtleties in your head when reading someone else’s code.
2 comments

Pointer vs value receivers and named returns have so many gotchas that it is not even funny. Lack of magic my ass.
The way you avoid these are twofold:

1) Use the pointer receiver unless you have a really good reason to do otherwise.

2) Never, ever use named returns. Code can (and should) always be written to not use them.

Can you elaborate point 2, please?I am wondering how is that related to the issue of pointer and value semantics.
Can you name any? I have never seen a “gotcha” because it’s just explicit… it’s not like you are surprised by a pointer.
Then why don’t we go back to assembly? There is even less magic there, every line is trivial to understand, isn’t it?