3 ms·
Excellent - thank you for that. I'm not sure I completely agree with their reasoning: the example only really got complicated when dealing with function pointe
by paupino_masano 14y ago
Excellent - thank you for that.
I'm not sure I completely agree with their reasoning: the example only really got complicated when dealing with function pointers, however that could be simplified with a macro (or a delegate in other languages).
I do agree that C can get complex to read, however I'm not sure switching the type/parameter option is the answer. But then again, I've probably become accustomed to this format. The real test will be using the language for a few weeks... I better start some small hobby projects in Go just to see if I end up liking it!
- drivebyacct2 14y agoint *i, j; is more than a good enough reason for me. Makes interviews interesting, though: "Why are you repeatedly writing your variables and function parameters incorrectly?"
- paupino_masano 14y agoInteresting example. I'm still a newbie to Go, so would that be written as: var i int* var j int My apologies if this seems like a simple question: I haven't played with the language enough to know :) [EDIT: Sorry, I didn't realize how to format code!]
- Jabbles 14y agoThe asterisk goes before the type for pointers: var i *int Unlike C, values are always initialized in Go. http://play.golang.org/p/8tAzKyES2I http://play.golang.org/p/8tAzKyES2I
- enneff 14y agoGo doesn't have macros, as they're a whole other can of worms, so the simplification one might use in C doesn't apply to Go. :-) Go has great support for closures, so you tend to use function types more often (or perhaps just more naturally) than in C. It is just a matter of getting used to it. I switch back and forth between Go and other languages, and it doesn't bother me. (The thing that does get me is forgetting to use semicolons in other languages.)
- paupino_masano 14y agoThanks again, I really appreciate your input! I'm going to have to switch between the two to get a feel for it (and like you say, get used to it). I'm a big fan for language grammars (I enjoy writing them myself) so am looking forward to digging into it some more to see how it all works :)