5 ms·
It's just code with comments what code is doing. Can we call them notes?
by mesaframe 6y ago
It's just code with comments what code is doing. Can we call them notes?
- Jestar342 6y agoIt's very clearly a lot more than just commented code. They are examples/snippets of common patterns.
- dgellow 6y agoTo answer to your comment: code with comments can be notes, yes.
- colesantiago 6y agoIt has Go code with comments which are notes to the author. just like the title of this post. would be useful to somebody, seems like a good idea to me.
- bouncycastle 6y agoGo is very readable. It seems I can understand what he's doing / means, even with Chinese comments!
- cy_hauser 6y agoMy first click was the link for "Accessing a value of an unexported identifier". Figured I'd see some reflection trick or similar. In looking at that code I still have no idea what it's doing in relation to accessing an unexported identifier. So I went to the next link down, "Unexported fields from an exported struct". Figured this would be the clever way to access the "message" field. But again I don't get it. It seems it's the same code as the last example. This either says something about my ability to understand Go code or that maybe a bit more exposition would be useful for at least some of the examples.
- bouncycastle 6y agoFor that, you will need to know a bit about Go. The full totorial is here https://www.ardanlabs.com/blog/2014/03/exportedunexported-identifiers-in-go.html https://www.ardanlabs.com/blog/2014/03/exportedunexported-id... So in the end there's really no trick, you still can't access them directly.
- smnscu 6y agoNot strictly related to OP but literate programming is pretty cool: https://en.wikipedia.org/wiki/Literate_programming https://en.wikipedia.org/wiki/Literate_programming